在Centos7下第一次安装dokcer,修改完daemon.js配置镜像加速器后docker restart失败了
[root@cola yum.repos.d]# sudo systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@cola yum.repos.d]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2022-11-14 09:38:40 CST; 14s ago
Docs: https://docs.docker.com
Process: 29503 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 29503 (code=exited, status=1/FAILURE)
Nov 14 09:38:38 cola systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Nov 14 09:38:38 cola systemd[1]: Failed to start Docker Application Container Engine.
Nov 14 09:38:38 cola systemd[1]: Unit docker.service entered failed state.
Nov 14 09:38:38 cola systemd[1]: docker.service failed.
Nov 14 09:38:40 cola systemd[1]: docker.service holdoff time over, scheduling restart.
Nov 14 09:38:40 cola systemd[1]: Stopped Docker Application Container Engine.
Nov 14 09:38:40 cola systemd[1]: start request repeated too quickly for docker.service
Nov 14 09:38:40 cola systemd[1]: Failed to start Docker Application Container Engine.
Nov 14 09:38:40 cola systemd[1]: Unit docker.service entered failed state.
Nov 14 09:38:40 cola systemd[1]: docker.service failed.
检查/etc/docker/daemon.json
vim /etc/docker/daemon.json
结果如下,要注意格式是否正确:
1.daemon.json每个属性之间的逗号,
2.镜像加速器地址是个数组,中括号不要忘了
{
"registry-mirrors": ["https://1egaw9mw.mirror.aliyuncs.com"]
}