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 *.*.*.*: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内容即可。

结束!

posted @ 2022-01-19 13:22  aaronthon  阅读(1003)  评论(0编辑  收藏  举报