首页 > 解决方案 > 码头工人注册表:https而不是http

问题描述

我刚刚部署了一个 docker 注册表。

我可以使用以下方法访问它:

$ curl -I chart-example.local/v2/                                                                                                                         
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Tue, 28 Jan 2020 20:10:35 GMT
Docker-Distribution-Api-Version: registry/2.0
Vary: Accept-Encoding
X-Content-Type-Options: nosniff

但是,当我尝试将本地图像推送到它时,我收到了以下消息:

$ docker push chart-example.local/feedly:latest                                                                                                                                                                                                                                                                          
The push refers to repository [chart-example.local/feedly]
Get https://chart-example.local/v2/: x509: certificate has expired or is not yet valid

为什么 docker 试图使用https而不是获得访问权限http

标签: dockerkubernetesdocker-registry

解决方案


Docker 默认使用 https 来保证安全。您可以通过daemon.json使用以下内容修改文件来覆盖此设置。不要在生产使用此设置。

 {
   "insecure-registries" : ["chart-example.local"]
 }

有关更多信息,请参阅此链接:https ://docs.docker.com/registry/insecure/


推荐阅读