Docker builds from Windows executor failing to retrieve packages from internet

Using a Windows executor, we are building a Windows container using docker in CircleCI.

Recently, builds have begun failing and we have traced the issue down to the inability of the docker build process to pull dependencies from the internet. For example, when trying to install Python in the image:

Downloading https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe ...
Invoke-WebRequest : The remote name could not be resolved: 'www.python.org'
At line:1 char:316
+ ... pe]::Tls12; Invoke-WebRequest -Uri $url -OutFile 'python.exe'; Write- ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
   pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
   ll.Commands.InvokeWebRequestCommand

This is new behavior, pipelines that successfully executed last week fail in this manner.

I suspect the networking connectivity to the docker build engine has been affected by some recent change in the CircleCI environment.

I have tried the –network=nat tag, to no avail. The only other option is to download all the packages outside of the docker build script, which is our last resort.

You are going to have to share more details about your environment as it is not possible to tell what environment your config.yml file is defining or what steps are taking place in your Dockerfile.

pretty standard

executor: win/server-2019 (have tried many variations)

CircleCI engineers provided a fix. Here’s the before and after of the Dockerfile

FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2

SHELL [“powershell”, “-Command”, “$ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’;”]
RUN New-Item C:/temp -ItemType Directory;
New-Item C:/data -ItemType Directory;

Modified per CircleCI engine, tested and working:

FROM mcr.microsoft.com/dotnet/framework/runtime:4.7.2

SHELL [“powershell”, “-Command”, “$ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘Continue’;
$verbosePreference=‘Continue’; netsh interface ipv4 set dnsserver 17 static address=8.8.8.8 register=primary;”]
RUN powershell Set-ExecutionPolicy Bypass -Scope Process -Force;
New-Item C:/temp -ItemType Directory;
New-Item C:/data -ItemType Directory;

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.