Docker not able to pull images behind proxy TLS handshake timeout

Akshay Hiremath picture Akshay Hiremath · Aug 17, 2018 · Viewed 32.2k times · Source

I have latest Docker version 18.06.0 installed on CentOS 7. My server is in a corporate network so using a proxy server to access the registry. I have added proxy settings as per docker documentation. But finally adding proxy settings in worked partially. i.e. now docker is using proxy to pull the image before it runs.

But now it fails giving following error:

$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: net/http: TLS handshake timeout.

Also, the login fails:

$ sudo docker login --username=XXXX
Password:
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF

My proxy is pretty fast. When I’m using it to download anything from the internet using wget or curl I see 90 to 100Mbps speed. Other applications utils on my machine such as yum are using this proxy perfectly and it works well. Now I don’t know why only Docker has a problem in downloading the images.

The details of installation and configuration are as follow:

Version:

$ sudo docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false

Server:

Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false

OS Version:

Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511

Docker proxy config:

$ cat /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”

after adding this configuration I have already done

sudo systemctl daemon-reload
sudo systemctl restart docker

Looking for specific help.

I have gone through most of the posts on TLS Handshake Timeout issues but didn’t get any answer or suggestions working for me. My proxy is fine and docker is using it. I don’t understand why it gets that nasty timeout.

Answer

sg qy picture sg qy · May 18, 2019

The config file is:

[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”

Notice that 3rd line: HTTPS_PROXY=https

Is the proxy server support HTTPS? Or there should be an error.

Maybe HTTPS_PROXY=http is correct.

By the way, a similar error is Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF