missing client certificate error while logging into private docker registry

Viewed 3015

I am trying to login into a private docker registry using docker community edition 18.06 for Mac, but i am getting this error while docker login from cli-

Error response from daemon: Missing client certificate domain.cert for key domain.key

First, I installed CA certificate in ~/.docker/certs.d/myprivaterepo:port using below commmands:

$ openssl genrsa -out client.key 4096
$ openssl req -new -x509 -text -key client.key -out client.cert

And it gave me error -

Error response from daemon: Get https://myprivaterepo:port/v2/: Service Unavailable

Then i generated the certificate with '.crt' format using above command and it started giving me this error:

Error response from daemon: Missing client certificate client.cert for key client.key

I am assuming it requires a key and both .crt and .cert certificates to be present. I infact tried creating another .cert certificate with another key, but it gave me below error:

Error response from daemon: tls: private key does not match public key

I referred to docker documentation- https://docs.docker.com/engine/security/https/, but could not resolve issue.

Can you please let me know how to generate the combination of these 2 certificates. Thanks in advance!

1 Answers

For me, renaming and putting the crt file in /usr/local/share/ca-certificates/ worked:

# copy and rename the file
cp client.crt /usr/local/share/ca-certificates/<my-private-repo>:<port>.crt

# update certificates
sudo ca-update-certificates

# restart docker daemon
sudo service docker restart
Related