我们直接进到docker官网,https://hub.docker.com/editions/community/docker-ce-server-centos?tab=resources
# 移除旧版本的docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 设置仓库
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 开始安装docker
sudo yum install docker-ce docker-ce-cli containerd.io
# 启动docker
sudo systemctl start docker
docker卸载
# 卸载docker
sudo yum remove docker-ce docker-ce-cli containerd.io
# 删除所有的配置文件
sudo rm -rf /var/lib/docker