0

I'm using windows containers in windows 10. I've set proxy variables(HTTP_PROXY,HTTPS_PROXY) in environmental variable setup and using VPN. I also configured resources -> Proxies.

I was trying to build docker image with following Dockerfile content.

FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["cmd", "/S", "/C"]

RUN mkdir c:\temp \
    && curl -SL --output c:\temp\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe

When this docker image build command is executed it shows following error.

Step 5/5 : RUN mkdir c:\temp     && curl -SL --output c:\temp\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe
 ---> Running in 0c134b2d004a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:12 --:--:--     0curl: (6) Could not resolve host: aka.ms
The command 'cmd /S /C mkdir c:\temp     && curl -SL --output c:\temp\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe' returned a non-zero code: 6

I tried to build this with build arguments, and added dns: 8.8.8.8 in docker deamon config file

docker build --build-arg HTTP_PROXY --build-arg HTTPS_PROXY --tag=tswin .

But above mentioned error is not solved.

When the same curl command is executed in Windows's CMD it is not throwing any error

C:\Users\mshanm6x>curl -SL --output c:\temp\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 1432k  100 1432k    0     0   238k      0  0:00:06  0:00:06 --:--:--  332k

Also the same Dockerfile was able to built by without HTTP_PROXY, HTTPS_PROXY env variables and VPN off.

What is the real issue. Why it is not working inside of container with proxy configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.