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.
- I have successfully built this Docker image on a machine I hand rolled, but the failure happens consistently on our provisioned build machine.
- I can RDP onto the machine and download the script outside the context of the docker container with no problem.
- I can ping chocolatey.org without issue within the Docker container.
- I can download the content of other sites from within the Docker container (i.e. google.com or nuget.org).
- 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.org, but nonetheless prevents reading the contents of URLs from there.
However I'm out of tools for troubleshooting and any ideas 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