一次docker服务启动失败的总结

1.去官网
2.看官网文档
文档地址:https://docs.docker.com/engine/install/centos/

01.移除旧的镜像
yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine

02.安装需要的包
yum install -y yum-utils

03.设置docker镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
----推荐使用阿里云

04.更新软件包索引
yum makecache fast

05.安装docker相关的内容 -- docker-ce 社区版 docker-ee 企业版
yum install docker-ce docker-ce-cli containerd.io -y

06.启动docker
systemctl start docker
systemctl enable docker
systemctl status docker

给docker配置阿里云镜像加速器
sudo mkdir -p /etc/docker

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

sudo systemctl daemon-reload
sudo systemctl restart docker

配置完镜像加速器之后发现docker启动不了了

然后把/etc/docker/key.json 默认的key.json修改为key.json.bak 给它备份起来
然后重新启动docker服务

原文地址:https://www.cnblogs.com/w1sh/p/14956231.html