menu 我的书签 Docker离线安装
文章开始
文章结尾

Docker离线安装

Docker安装

离线安装

wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.6.tgz
tar -zxvf docker-24.0.6.tgz
sudo cp docker/* /usr/bin/
vim /etc/systemd/system/docker.service

然后在文件中添加以下内容,退出并保存。

[Unit]Description=Docker Application Container EngineDocumentation=https://docs.docker.comAfter=network-online.target firewalld.serviceWants=network-online.target​[Service]Type=notifyExecStart=/usr/bin/dockerdExecReload=/bin/kill -s HUP $MAINPIDLimitNOFILE=infinityLimitNPROC=infinityTimeoutStartSec=0Delegate=yesKillMode=processRestart=on-failureStartLimitBurst=3StartLimitInterval=60s​[Install]WantedBy=multi-user.target​
chmod +x /etc/systemd/system/docker.servicesystemctl daemon-reload 
systemctl enable docker.service
systemctl start docker
docker run hello-world

卸载步骤

步骤一:停止docker

sudo systemctl stop docker

步骤二:删除Docker服务

# 移除开机自启动systemctl disable docker.service# 删除service服务rm -f /etc/systemd/system/docker.service

步骤三:删除Docker相关命令

rm -f /usr/bin/docker*rm -f /usr/bin/containerd*rm -f /usr/bin/ctrrm -f /usr/bin/runc

步骤三:删除docker目录和容器相关文件

sudo rm -rf /var/lib/dockersudo rm -rf /var/lib/containerd

步骤四:验证是否已成功卸载

docker --version

在线安装

参考官方文档:Docker安装步骤