1. 程式人生 > >解決Job for docker.service failed because the control process exited with error code. See "systemctl s

解決Job for docker.service failed because the control process exited with error code. See "systemctl s

在ubuntu16.04下安裝安裝docker docker daemon啟不起來,報如下錯誤:

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

解決方法:

修改docker.service內容:

sudo vim /lib/systemd/system/docker.service


ExecStart=/usr/bin/dockerd -H fd:// 改成

ExecStart=/usr/bin/dockerd -H fd:// -s overlay2 

然後執行:

sudo systemctl daemon-reload

sudo systemctl restart docker

成功啟動docker

-------------------------------------------------------------------add on----------------------------------------------------------------------------

如果需要pull docker映象的私有倉庫(一般是公司內網的registry),我們這裡假設私有倉庫IP為10.27.168.88,則需要

ExecStart=/usr/bin/dockerd -H fd:// -s overlay2  --dns 10.xx.xxx.xx --dns 8.8.8.8 --insecure-registry 10.27.168.88:5000

不想用ip也可以域名,只要做好dns解析就好了

eg:ExecStart=/usr/bin/dockerd -H fd:// -s overlay2  --dns 10.xx.xxx.xx --dns 8.8.8.8 --insecure-registry my_registry:5000

其中--dns 10.xx.xxx.xx是公司內網的dns伺服器 ,my_registry是私有倉庫的域名,如果沒有可以直接用私有倉庫ip來替代,不想用ip的可以在/etc/hosts下新增一下

10.27.168.88  my_registry   #假設私有倉庫的ip是10.27.168.88的話。