Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker SSL Cert for windows

Tags:

docker

windows

I am trying to publish a docker image to a private repository, but I cannot figure out where I am suppose to place the SSL cert on a Windows machine.

According to this page https://docs.docker.com/engine/security/certificates/ the cert is supposed to go in the /etc/docker/certs.d/HOSTNAME directory. This is clearly not a Windows path. However when I run the docker terminal and I type cd /etc it does take me to a working directory.

After some investigation I discovered it was going to C:\Program Files\Git\etc, So I created a docker\certs.d\docker-registry.lan (docker-registry.lan is our internal registry) directory under that path. Then I restart docker machine with a docker-machine stop, docker-machine start commands.

However when I try a push I am getting an error that says x509: certificate signed by unknown authority

This key works fine for others that are doing this through linux so I know the key is fine. I believe the problem is that I am not storing the key in the correct location.

I have tried a bunch of different loactions for the key, but none seems to work. This has to be an easy fix that I am missing. Can someone who has solved this help me?

Thanks

like image 576
ryanmc Avatar asked Mar 16 '16 16:03

ryanmc


2 Answers

Things have changed and there is no need to put cert files or worry about port numbers anywhere on Windows 10. (As of 7/21/2019)

On Docker Community 2.0.0.3 (31259) simply add the public cert of your docker repo to the "Trusted Root Authorities Store" on the local machine. You can double click on your certificate and it will start the process of asking you where you'd like to put it. (It may work for current user store as well, didn't check).

Once you add the cert to the store, restart the Docker service and you can then push/pull from your private repo.

The docker VM underneath gets all the trusted root authorities from Windows during startup and manages that for you.

like image 91
Matt Avatar answered Oct 25 '22 02:10

Matt


If you're running Docker daemon natively on Windows, the correct location is C:\ProgramData\docker\certs.d\myregistrydomain.com5000\ca.crt. Details here: https://github.com/docker/docker/issues/21189#issuecomment-234997515

like image 24
friism Avatar answered Oct 25 '22 01:10

friism