docker离线安装

无网络安装docker

# 下载离线安装包:
https://download.docker.com/linux/static/stable/$(arch)/docker-20.10.0.tgz

# 解压
tar zxf docker-20.10.0.tgz

# 拷贝包所有服务等
cp docker/* /usr/bin/

# 将docker注册为服务
vim /etc/systemd/system/docker.service

[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
LimitCORE=infinity
#TasksMax=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target


# 添加可执行权限
chmod +x /etc/systemd/system/docker.service

# 加载配置文件
systemctl daemon-reload

# 启动dockerd
dockerd &

# 查看相关信息
docker info

# 查看docker状态
systemctl status docker
# 如果失败或重启也失败,尝试杀死docker相关进程,再重启docker
ps -ef | grep docker
kill -9 XXXXX