1. 程式人生 > 其它 >Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

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

當我們向私有倉庫推送映象,如下:

$ docker push 10.255.67.131:5000/pod-infrastructure:latest
The push refers to a repository [*.*.*.*:5000/pod-infrastructure]
Get https://*.*.*.*:5000/v1/_ping: http: server gave HTTP response to HTTPS client

原因是:Docker自從1.3.X之後docker registry互動預設使用的是HTTPS,但是搭建私有映象預設使用的是HTTP服務導致。

處理辦法如下:

# 修改啟動檔案第12行 
$ vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry *.*.*.*:5000

或者

$ vim /etc/docker/daemon.json
{
"insecure-registries":["*.*.*.*:5000"]
}

重啟docker服務

$ systemctl daemon-reload
$ systemctl restart docker

如出現如下報錯:

$ 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.

這個可能是/etc/docker/daemon.json內容配置有誤,需要認真檢查;

或者/etc/sysconfig/docker裡面已經配置了insecure-registries內容,重複配置導致的問題,刪掉重複的insecure-registries內容即可。

結束!