yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine
/var/lib/docker
# 1.docker 须要的安装包
yum install -y yum-utils
# 2. 镜像仓库
yum-config-manager
--add-repo
https://download.docker.com/linux/centos/docker-ce.repo # 默认是国外的,比较慢
yum-config-manager
--add-repo
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # docker 阿里镜像库「快」
# 3. 装置 docker 相干「ce 社区版,ee 企业版」yum install docker-ce docker-ce-cli containerd.io
# 4. 更新软件包索引
yum makecache fast
# 5. 启动 docker
systemctl start docker
# 6. 查看 docker 版本
docker version
# 7. 装置 hello-world
docker run hello-world
# 8. 查看 docker 镜像
docker images
# 9. 卸载 docker
# 9.1. 卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
# 9.2. 删除资源
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
# 配置应用
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://r0gd3ueb.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker