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
#设置docker下载地址
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
sudo systemctl start docker
访问阿里云镜像加速服务:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
# 1、创建目录
sudo mkdir -p /etc/docker
# 2、配置镜像加速器地址
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["填写为自己的镜像加速服务地址"]
}
EOF
# 3、启动docker后台线程
sudo systemctl daemon-reload
# 4、重启docker服务
sudo systemctl daemon-reload