yum update -y
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo   https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y 
sudo yum install docker-ce docker-ce-cli
sudo systemctl start docker
docker --version
sudo systemctl enable docker

出现安装包问题

sudo yum install docker-ce docker-ce-cli containerd.io -y --allowerasing

更换容器镜像

https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

cd /etc/docker

vim daemon.json

# url改成自己的加速器地址,亦可使用该地址
{
  "registry-mirrors": ["https://k01sfudd.mirror.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker

Re:

https://blog.csdn.net/jcmj123456/article/details/117742182

https://www.jianshu.com/p/6d9e725da273