title: Diagnosing download timeout from chocolatey.org in a Windows Docker build
body: <p>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</p>
  
  <pre><code>Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  </code></pre>
  
  <p>The full error is below.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>This seems strange for a number of reasons.</p>
  
  <ol>
  <li>I have successfully built this Docker image on a machine I hand
  rolled, but the failure happens consistently on our provisioned build
  machine.</li>
  <li>I can RDP onto the machine and download the script outside the
  context of the docker container with no problem.</li>
  <li>I can ping chocolatey.org without issue within the Docker container.</li>
  <li>I can download the content of other sites from within the Docker
  container (i.e. google.com or nuget.org).</li>
  <li>I have completely destroyed this build machine and provisioned a new
  one (via BOSH).</li>
  </ol>
  
  <p>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.</p>
  
  <p>However I'm out of tools for troubleshooting and any ideas would be greatly appreciated.</p>
  
  <p>Full Docker file</p>
  
  <pre><code>FROM microsoft/windowsservercore:1709
  
  COPY install.ps1 /install.ps1
  RUN powershell /install.ps1
  
  ENTRYPOINT powershell
  </code></pre>
  
  <p>Full install.ps1</p>
  
  <pre><code>$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
  </code></pre>