dockerkubernetesdocker-registry

docker registry: https instead of http


I've just deployed a docker registry.

I'm able to get access to it using:

$ 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

However, when I'm trying to push an local image to it, I'm getting this message:

$ 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

Why docker is trying to get access using https instead of http?


Solution

  • Docker uses https by default for security. You can override this setting by modifying your daemon.json file with the following content. Do not use this setting in production.

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

    Docker will use http://chart-example.local and not https://chart-example.local
    See this link for more information: https://docs.docker.com/registry/insecure/