移除旧版本

yum remove docker

安装工具包

yum install -y yum-utils

设置镜像源

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装docker

yum install docker-ce 

配置容器加速

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://c6kevxpj.mirror.aliyuncs.com"]
}
EOF

重新启动

sudo systemctl daemon-reload
sudo systemctl restart docker