WSL 2 Docker Behind Proxy

Stevegy
1 min readJul 20, 2020

--

Start from the Windows 10 2004, the Docker is now could be a “real” service inside WSL 2.0.

But if you need to pull images from docker hub in an enterprise network behind a proxy server, you may experience the docker daemon connection EOF issue.

The docker daemon in WSL 2.0 is started from “sudo service docker start” command. That is a call to the /etc/init.d/docker script. A possible workaround is to modify that script adding an external environment variables to declare the proxy settings. That script will call /etc/default/docker, as the /etc/default/docker should include like:

export HTTP_PROXY=”http://web-proxy:8080"
export HTTPS_PROXY=”http://web-proxy:8080"
export NO_PROXY=”localhost,127.0.0.0/8,172.16.0.0/12,192.168.0.0/16,10.0.0.0/8”

And you should replace the web-proxy to your real proxy and port.

--

--

No responses yet