i've set up a docker registry server within a vm. The server has a ssl-certificate signed by a CA that is within my windows trusted root certificates.
To access the registry I've created a ssh tunnel forwarding my local port 5000 to the vm targeting [localhost:5000]. If I open https://localhost:5000 on my machine with a browser, everything checks out fine. The cert is considered valid.
Within a shell on the vm, docker login works perfectly fine. It asks for my credentials and stores them. I'm able to push images into the registry as expected.
Whenever I try to login from my developer machine connected via the tunnel, my local docker seems to ignore anything SSL:
C:\WINDOWS\system32>docker login https://localhost:5000
Username: ******
Password: ******
Error response from daemon: Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect: connection refused
docker login seems to use HTTP instead of HTTPS which it is supposed to do. I can't figure out, how to force docker login to use SSL.
Any suggestions would be very well appreciated!
Cheers,
Corelgott
Ok I've figured it out.
[tl;dr]
On windows docker login localhost referes to the moby-vm running the daemon and not to the windows-system.
Since we are forced to use windows 10 as OS, docker uses it's moby-vm via hyper-v / virtualbox / hypervisor to run the "local" docker daemon. So when I type docker login localhost:5000 into my windows shell, the command is not run by my machine, but by the daemon, which resides in the vm. In this context "localhost" doesn't refere to my dev-system but to the vm the daemon is running in.
To resolve it, I had to:
docker login hostname:5000 (Where hostname is the name of my development-machine that the vm can resolve and access. You can use the command hostname in the commandline to find it.)Now SSL, auth, push and pull seem to work as expected. Quite an odd error behaviour, but it kind of makes sense since there is no registry-server running witihn the docker-daemon-vm.
I hope this post saves somebody else some time.
Cheers,
Corelgott
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With