1. 程式人生 > >Docker配置映象加速器重啟Docker服務失敗

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.
檢視原因:
{
  "registry-mirrors": "https://docker.mirrors.ustc.edu.cn"
}
改成:
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
解決問題