Docker配置镜像加速器重启Docker服务失败

  安装好docker之后,准备开始安装容器,然后发现直接安装Ubuntu一直显示超时。据说是被墙了,要使用国内镜像,于是新建了了/etc/docker/daemon.json,加了一个国内的镜像地址。

执行:service docker start

Job for docker.service failed because the control process exited with error code.See "systemctl status docker.service" and "journalctl -xe" for details.

嗯,挂了,报错了。

执行systemctl status docker.service

报错在/lib/systemd/system/docker.service的

ExecStart=/usr/bin/dockerd -H fd
docker启动的时候走/etc/docker/daemon.json配置,然后发现 /lib/systemd/system/docker.service里面也有一个这样的配置,于是报错了,
ExecStart=/usr/bin/dockerd -H fd这一行注释掉,改成ExecStart=/usr/bin/dockerd,然后重新启动service docker start
还是报错

Job for docker.service failed because the control process exited with error code.See "systemctl status docker.service" and "journalctl -xe" for details.
查看原因:

/etc/docker/daemon.json“json: cannot unmarshal string into Go value of type []string”,daemon.json里面写的不对

{
  "registry-mirrors": "https://docker.mirrors.ustc.edu.cn"
}
改成:
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
解决问题

猜你喜欢

转载自blog.csdn.net/qq_26400953/article/details/79913367