'Docker Error when proxy is set : proxyconnect tcp: dial tcp: lookup http: no such host

I am facing one weird issue with docker. We have a corporate proxy and using docker on Windows server 2016.

I am trying to pull docker image from dockerhub.

Started facing this issue recently. It was working fine earlier.

Steps

1) Set HTTP and HTTPS Proxy

2) Executed docker pull hello-world:nanoserver

Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup http: no such host

enter image description here

Any idea whats going wrong here. I have couple of other machines having same setting and works fine.

Update 1: 06/03/2019

I did some trial and error and found that docker version is the culprit here.

I installed docker 17.06.2-ee-17, 17.06.2-ee-16 and tried pulling image. It worked fine.

enter image description here

So now question is what is wrong with latest 3 versions of docker ee for windows. i.e 17.06.2-ee-18,17.06.2-ee-19,17.06.2-ee-20 which is giving me this error.



Solution 1:[1]

We had exactly the same issues.

It appears to work in the newer versions when we used the fully qualified version of our proxy server.

i.e. http://proxy-server.my-domain.net:8080 instead of http://proxy-server:8080

Solution 2:[2]

Sorry, My answer is for Linux ("Error response from daemon: Get https://registry-1.docker.io/v2/:Proxyconnect tcp: dial tcp:lookup proxy.example.com:no such host")

Firsty check docker version with this command ($docker -v )
Output: Docker version 19.03.10, build 9424aeaee9 (Can be any version)

Check Can you ping to google ($ping google.com )
If it work, dont need to fix the file (/etc/hosts and /etc/resolv.conf)

$sudo snap install docker

Then check PATH environment variable
$echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin ( Output must be like this)

The output doesn't include /snap/bin path. You can define with below command
$export -n PATH=$PATH:/snap/bin
$echo $PATH ( check with this command )

Now login to docker hub
$docker login

When login succeeded,can pull any images from docker hub
$docker pull hello-world

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eddy Kavanagh
Solution 2