Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker not able to pull images behind proxy TLS handshake timeout

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.

like image 971
Akshay Hiremath Avatar asked Aug 17 '18 07:08

Akshay Hiremath


2 Answers

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

like image 126
sg qy Avatar answered Nov 02 '22 23:11

sg qy


I was also facing same issue behind firewall. Follow below steps:

$ sudo vim /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment=“HTTP_PROXY=http://username:password@IP:port/”

Don’t use or remove https_prxoy.conf file.

reload and restart your docker

    $ sudo systemctl daemon-reload
    $ sudo systemctl restart docker
    $ docker pull hello-world
    Using default tag: latest
    latest: Pulling from library/hello-world
    1b930d010525: Pull complete
    Digest: sha256:2557*********************************8
Status: Downloaded newer image for hello-world:latest
like image 41
Abhishek Avatar answered Nov 02 '22 23:11

Abhishek