Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make CNTLM proxy available/ configure it for all docker container running in Docker for Windows WSL2

Tags:

docker

I am running Docker for Windows WSL2. Within Windows i configured a PAC file that send specified URL (from company) through CNTLM running on localhost:3128.

Because i guess it is not easy to tell a Docker Container to "use" the PAC file it would be enough to be able to configuere certain containers to use proxy.

What i tried so far: https://docs.docker.com/network/proxy/ In my case i put

 {
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://127.0.0.1:3128",
     "httpsProxy": "http://127.0.0.1:3128",
     "noProxy": "localhost"
   }
 }
}

in ~/.docker/config.json where ~ is pointing to /var/jenkins_home. This setting seems to be completely ignored - the proxy is just not used.

Since it is a jenkins container i tried to set the proxy in the appropriate dialog. There i set 127.0.0.1:3128. But a test yield "connection refused". I am just not sure if CNTLM is available from within Docker and make it available.

In best case there is some Docker Container which i can feed the PAC and use this container as proxy for all others.

like image 211
dermoritz Avatar asked Jan 21 '26 20:01

dermoritz


1 Answers

I have a similar setup, I managed to make it work using docker internal proxy host.docker.internal in my config.json like so:

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://host.docker.internal:3128",
     "httpsProxy": "http://host.docker.internal:3128",
     "noProxy": "localhost"
   }
 }
}

See documentation for more details https://docs.docker.com/docker-for-windows/networking/

like image 144
Simon30 Avatar answered Jan 23 '26 09:01

Simon30



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!