【解决】http: server gave HTTP response to HTTPS client

 

【问题】上传镜像到私有仓库时报错

$ docker push xxx.xxx.xxx.xxx:5000/java-8
The push refers to repository [xxx.xxx.xxx.xxx/java-8]
Get https://xxx.xxx.xxx.xxx:5000/v2/: 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 xxx.xxx.xxx.xxx:5000

# 或者增加deamon.json文件配置
$ vim /etc/docker/daemon.json { "insecure-registries":["xxx.xxx.xxx.xxx:5000"] }
# 最后重启服务
$ systemctl daemon-reload $ systemctl restart docker
复制代码

你可能感兴趣的:(【解决】http: server gave HTTP response to HTTPS client)