简体   繁体   中英

Login to docker registry with client certificate under windows

The docker documentation here describes how to configure docker in order to connect to a registry that requires a client certificate. Under Ubuntu it works: I place the client.crt and client.key files into the folder /etc/docker/certs.d/<myregistry>/ as stated by the documentation ... and it works.

Unfortunately, there is no specific documentation how to configure docker under windows (wsl backend) to achieve the same result... and I stuck... I performed following attempts:

  • Imported the private key and certificate into the windows certificate manager, restarted docker
  • added the cert and key files into the docker-desktop wsl file system in /etc/docker/certs.d/<myregistry>/ , restarted docker...
  • added the cert and key files into the docker-desktop-data wsl file system in /etc/docker/certs.d/<myregistry>/ , restarted docker
  • added the cert and key files into the docker-desktop wsl file system in /root/.docker/certs.d/<myregistry>/ , restarted docker
  • added the cert and key files into the docker-desktop-data wsl file system in /root/.docker/certs.d/<myregistry>/ , restarted docker

I always get the same result:

PS C:\> docker login -u <remote_user> <myregistry>
Password:
Error response from daemon: login attempt to https://<myregistry>/v2/ failed with status: 400 Bad Request

Any Idea?

I found it! You need to place the cert and key files into the C:\Users\<user>\.docker\certs.d\<mysite>\ as follows:

C:\Users\<user>\.docker\certs.d\<mysite>\client.cert
C:\Users\<user>\.docker\certs.d\<mysite>\client.key

Docker must be restarted and after that, the login with the command docker login <mysite> does not fail anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM