docker login behind proxy on private registry gives TLS handshake timeout

actually, I found that if I comment out the full Environment line it works for the private registry but not for docker hub anymore (of course, no more proxy). And here is the final solution that works for both private registry and docker hub public registry:

In the NO_PROXY environment variable, only the domain name should be used, not the FQDN (including "archive." hostname prefix):

Here is my config file now:

[Service]
Environment="HTTP_PROXY=http://proxy.mycompany.com:8000/" "NO_PROXY=localhost,127.0.0.1,docker-registry.mycompany.com"

Note that there is no more "archive." nor "portus." prefix in NO_PROXY anymore, just the domain name starting from "docker-registry".

As I saw the docker login command line including "archive." prefix, it was misleading and I thought it had to be in the NO_PROXY environment variable... but no, it should not.

Hope it helps someone. I wish I found the answer on google before, but I didn't so I'm just posting it here, it might help someone.


If you are using a private registry, you need to place the certificate for that under /etc/docker/certs.d/registryname/ca.crt

registryname will change accordingly

Also, please change your MTU size to 1300, this was also one thing I did to resolve the error. Registry one I believe you might have already done. Command for MTU change

ip link set dev eth0 mtu 1300

MTU size is important to check

Tags:

Docker

Proxy