Appearance
离线安装 docker
下载安装包
官方网站:https://download.docker.com/linux/static/stable/x86_64/
shell
# x86架构
wget https://download.docker.com/linux/static/stable/x86_64/docker-27.1.0.tgz
# arm架构
wget https://download.docker.com/linux/static/stable/aarch64/docker-27.1.0.tgz
## 解压与拷贝
```shell
tar -zxvf docker-27.1.0.tgz
sudo cp docker/* /usr/bin/
写入配置文件
shell
sudo vim /etc/systemd/system/docker.service
写入以下内容:
shell
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
给予可执行权限,并重新加载systemd程序的配置文件
shell
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
设置docker开机自启
shell
systemctl enable docker.service
启动
shell
systemctl start docker
查询docker服务状态
shell
systemctl status docker