I am using Docker for Windows
Version 17.09.0-ce-win33 (13620)
Channel: stable
8c56a3b
on Windows 10
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.15063 N/A Build 15063
I am trying to run a Windows container behind a http proxy server. I have added my proxy information in the Docker settings dialog. I can pull images from Docker Hub so the proxy settings seems to work as expected.
When I run a Linux container it can access the internet just fine but when I run a Windows container it does not use the proxy and I can not access the internet. I useed the Invoke-Webrequest cmdlet to test the connectivity to the internet from my container. I tried to add the proxy settings to my Windows container as well.
First I added the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer in the registry.
I tried to add the value in two different ways
{myproxy}:{myport}
and
http={myproxy}:{myport};https={myproxy}:{myport}
I tried to set the proxy with netsh winhttp set proxy proxy-server=“http={myproxy}:{myport};https={myproxy}:{myport}” bypass-list="{mybypasslist}"
I tried both at the same time and separate. I tried to do everything in the Dockerfile and in the powershell prompt in the container. Nothing works. The Invoke-Webrequest cmdlet do not use the proxy server when making a call to the internet.
I can see in Wireshark that the container tries to call the IP for the url not the IP for the proxy server.
I also tried to set the environmentvariabels HTTP_PROXY and HTTPS_PROXY on both my docker host and in the Windows container. Did not work.
I think i tried every combination of the above.
Just to verify that nothing is wrong with our proxy server I tried to specify the proxy in the Invoke-Webrequest like this:
Invoke-WebRequest -Uri $url -Proxy $proxy -OutFile install.ps1 and it works! I can see in Wireshark that the proxy server is called with the http request.
So my question is. How do I specify the proxy server a Windows container should use?