Docker 私有倉庫,上傳映象報錯:server gave HTTP response to HTTPS client

衣舞晨風發表於2017-05-05

具體錯誤資訊如下:

The push refers to a repository [hub.docker.jiankunking.io:5000/haproxy]
Get https://hub.docker.jiankunking.io:5000/v1/_ping: http: server gave HTTP response to HTTPS client

今天build了一個haproxy 1.5的映象,想傳到內網私服上
1、修改映象的名字REPOSITORY為:hub.docker.jiankunking.io:5000/haproxy,TAG標識為:1.5
這裡寫圖片描述
2、修改build映象所在機器的hosts檔案

vi /etc/hosts

在hosts檔案中新增域名與ip的對映

10.10.10.10  hub.docker.jiankunking.io

3、push映象到私服

sudo docker push hub.docker.jiankunking.io:5000/haproxy:1.5

然並軟,報錯了,具體錯誤資訊如下:

The push refers to a repository [hub.docker.jiankunking.io:5000/haproxy]
Get https://hub.docker.jiankunking.io:5000/v1/_ping: http: server gave HTTP response to HTTPS client

解決辦法:
在”/etc/docker/“目錄下,建立”daemon.json“檔案。在檔案中寫入:

{
    "insecure-registries": [
        "hub.docker.jiankunking.io:5000"
    ]
}
//多個私服寫法,逗號分隔即可
{
    "insecure-registries": [
        "test.docker.jiankunking.io:5000", 
        "hub.docker.jiankunking.io:5000"
    ]
}

儲存退出後,重啟docker

systemctl restart docker

再次推送,問題搞定。
這裡寫圖片描述

Docker 私有倉庫,pull映象報錯:server gave HTTP response to HTTPS client

本文參考:http://www.bbsmax.com/A/A7zg22MVd4/

作者:jiankunking 出處:http://blog.csdn.net/jiankunking

相關文章