卸载已经安装的Docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
添加阿里镜像
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
查看可以安装的docker版本
yum list docker-ce --showduplicates
安装18.03.1
sudo yum install docker-ce-18.03.1.ce
启动 Docker
systemctl enable docker
systemctl start docker
设置Docker阿里云加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
注意:需要替换
xxxxx
为你的阿里云加速器地址,该加速器地址获取方法可以参考我的另外一篇教程:配置Aliyun Docker加速器