官方在线文档
1. 清理残留
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2. 设置仓库
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3. 安装 docker的containerd.io
sudo yum install docker-ce docker-ce-cli containerd.io
4. 启动docker
sudo systemctl start docker
5. 查看当前镜像(空的)
sudo docker images
6. 设置开机自启
sudo systemctl enable docker
7. 配置阿里云镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://2lha3xcc.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
说明: 配置阿里云镜像加速后,docker pull拉取镜像起飞...