Docker Community Forums

Share and learn in the Docker community.

Diagnosing download timeout from chocolatey.org in windows docker build


(Sarudak) #1

I’m trying to put together a windows docker container that can run .NET builds. Given the dependencies I need the best way to do so seemed to be to make use of chocolatey. However in the install step for chocolatey I am getting a download timeout trying to run the command

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

The full error is below.

Exception calling "DownloadString" with "1" argument(s): "The operation has 
timed out"
At C:\install.ps1:3 char:51
+ ... ess -Force; iex ((New-Object System.Net.WebClient).DownloadString('ht ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE 
   xception
    + FullyQualifiedErrorId : WebException

This seems strange for a number of reasons.

  1. I have successfully built this docker image on a machine I hand
    rolled but the failure happens consistently on our provisioned build
    machine
  2. I can RDP onto the machine and download the script outside the
    context of the docker container with no problem
  3. I can ping chocolatey.org without issue within the docker container
  4. I can download the content of other sites from within the docker
    container (ie google.com)
  5. I have completely destroyed this build machine and provisioned a new
    one (via BOSH)

Conclusion: There seems to be some kind of networking issue related to docker that does not prevent connection to the servers at chocolatey but nonetheless prevents reading the contents of URLs from there.

I am however out of ideas for troubleshooting. Any help would be greatly appreciated.

Full docker file

FROM microsoft/windowsservercore:1709

COPY install.ps1 /install.ps1
RUN powershell /install.ps1

ENTRYPOINT powershell

Full install.ps1

$ErrorActionPreference = "Stop"

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

choco install 7zip -y
choco install visualstudio2017professional -y
choco install visualstudio2017-workload-manageddesktop --includeOptional --pre -y
choco install visualstudio2017-workload-universal --includeOptional --pre -y

choco install nuget.commandline