title: Python cannot access internet from within windows container
body: <p><strong>TL;DR</strong></p>
  <p>Docker for windows container can access the internet when pinging but python running inside the container cannot.
  How can this be?</p>
  <p><strong>Details</strong></p>
  <p>I have pulled the image: <code>python:3.10.0a3-windowsservercore-1809</code>
  I can start a container based on it using : <code>docker run -it --rm --dns 41.212.0.100  python:3.10.0a3-windowsservercore-1809  cmd</code>
  Once started I can ping bing.com  with 0% packet loss</p>
  <p>However when I try to do a pip install or use the urlib module or the sockets module to access the internet, I get a timeout error:</p>
  <pre><code>WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(&lt;pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001C7EA3C03D0&gt;, 'Connection to pypi.org timed out. (connect timeout=15)')
  </code></pre>
  <p>I also tried to increase the timeout parameter for pip and irllib but still they were timing out.</p>
  <p><strong>Docker Info</strong></p>
  <pre><code>Server:
   Images: 1
   Server Version: 20.10.0
   Storage Driver: windowsfilter
    Windows:
   Logging Driver: json-file
   Plugins:
    Volume: local
    Network: ics internal l2bridge l2tunnel nat null overlay private transparent
    Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
   Swarm: inactive
   Default Isolation: hyperv
   Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
   Operating System: Windows 10 Enterprise Version 1809 (OS Build 17763.1577)
   OSType: windows
   Architecture: x86_64
   CPUs: 4
   Total Memory: 7.885GiB
   Docker Root Dir: C:\ProgramData\Docker
   Debug Mode: false
   Registry: https://index.docker.io/v1/
   Labels:
   Experimental: false
   Insecure Registries:
    127.0.0.0/8
   Live Restore Enabled: false
   Product License: Community Engine
  </code></pre>
  <p><strong>Docker inspect container</strong></p>
  <pre><code>[
      {
       
         
          &quot;State&quot;: {
              &quot;Status&quot;: &quot;running&quot;,
              &quot;Running&quot;: true,
              &quot;Paused&quot;: false,
              &quot;Restarting&quot;: false,
              &quot;OOMKilled&quot;: false,
              &quot;Dead&quot;: false,
              &quot;ExitCode&quot;: 0,
              &quot;Error&quot;: &quot;&quot;,
          },
          &quot;ResolvConfPath&quot;: &quot;&quot;,
          &quot;HostnamePath&quot;: &quot;&quot;,
          &quot;HostsPath&quot;: &quot;&quot;
        
          &quot;Driver&quot;: &quot;windowsfilter&quot;,
          &quot;Platform&quot;: &quot;windows&quot;,
          &quot;MountLabel&quot;: &quot;&quot;,
          &quot;ProcessLabel&quot;: &quot;&quot;,
          &quot;AppArmorProfile&quot;: &quot;&quot;,
          &quot;ExecIDs&quot;: null,
          &quot;HostConfig&quot;: {
              &quot;Binds&quot;: null,
              &quot;ContainerIDFile&quot;: &quot;&quot;,
              &quot;LogConfig&quot;: {
                  &quot;Type&quot;: &quot;json-file&quot;,
                  &quot;Config&quot;: {}
              },
              &quot;NetworkMode&quot;: &quot;default&quot;,
              &quot;PortBindings&quot;: {},
              &quot;RestartPolicy&quot;: {
                  &quot;Name&quot;: &quot;no&quot;,
                  &quot;MaximumRetryCount&quot;: 0
              },
              &quot;AutoRemove&quot;: true,
              &quot;VolumeDriver&quot;: &quot;&quot;,
              &quot;VolumesFrom&quot;: null,
              &quot;CapAdd&quot;: null,
              &quot;CapDrop&quot;: null,
              &quot;Capabilities&quot;: null,
              &quot;Dns&quot;: [
                  &quot;41.212.0.100&quot;
              ],
              &quot;DnsOptions&quot;: [],
              &quot;DnsSearch&quot;: [],
              &quot;ExtraHosts&quot;: null,
              &quot;GroupAdd&quot;: null,
              &quot;IpcMode&quot;: &quot;&quot;,
              &quot;Cgroup&quot;: &quot;&quot;,
              &quot;Links&quot;: null,
              &quot;OomScoreAdj&quot;: 0,
              &quot;PidMode&quot;: &quot;&quot;,
              &quot;Privileged&quot;: false,
              &quot;PublishAllPorts&quot;: false,
              &quot;ReadonlyRootfs&quot;: false,
              &quot;SecurityOpt&quot;: null,
              &quot;UTSMode&quot;: &quot;&quot;,
              &quot;UsernsMode&quot;: &quot;&quot;,
              &quot;ShmSize&quot;: 0,
              &quot;ConsoleSize&quot;: [
                  47,
                  189
              ],
              &quot;Isolation&quot;: &quot;hyperv&quot;,
              &quot;CpuShares&quot;: 0,
              &quot;Memory&quot;: 0,
              &quot;NanoCpus&quot;: 0,
              &quot;CgroupParent&quot;: &quot;&quot;,
              &quot;BlkioWeight&quot;: 0,
              &quot;BlkioWeightDevice&quot;: [],
              &quot;BlkioDeviceReadBps&quot;: null,
              &quot;BlkioDeviceWriteBps&quot;: null,
              &quot;BlkioDeviceReadIOps&quot;: null,
              &quot;BlkioDeviceWriteIOps&quot;: null,
              &quot;CpuPeriod&quot;: 0,
              &quot;CpuQuota&quot;: 0,
              &quot;CpuRealtimePeriod&quot;: 0,
              &quot;CpuRealtimeRuntime&quot;: 0,
              &quot;CpusetCpus&quot;: &quot;&quot;,
              &quot;CpusetMems&quot;: &quot;&quot;,
              &quot;Devices&quot;: [],
              &quot;DeviceCgroupRules&quot;: null,
              &quot;DeviceRequests&quot;: null,
              &quot;KernelMemory&quot;: 0,
              &quot;KernelMemoryTCP&quot;: 0,
              &quot;MemoryReservation&quot;: 0,
              &quot;MemorySwap&quot;: 0,
              &quot;MemorySwappiness&quot;: null,
              &quot;OomKillDisable&quot;: false,
              &quot;PidsLimit&quot;: null,
              &quot;Ulimits&quot;: null,
              &quot;CpuCount&quot;: 0,
              &quot;CpuPercent&quot;: 0,
              &quot;IOMaximumIOps&quot;: 0,
              &quot;IOMaximumBandwidth&quot;: 0,
              &quot;MaskedPaths&quot;: null,
              &quot;ReadonlyPaths&quot;: null
          },
          &quot;GraphDriver&quot;: {
              &quot;Data&quot;: {
                  
              },
              &quot;Name&quot;: &quot;windowsfilter&quot;
          },
          &quot;Mounts&quot;: [],
          &quot;Config&quot;: {
              &quot;Hostname&quot;: &quot;32cfd271955e&quot;,
              &quot;Domainname&quot;: &quot;&quot;,
              &quot;User&quot;: &quot;&quot;,
              &quot;AttachStdin&quot;: true,
              &quot;AttachStdout&quot;: true,
              &quot;AttachStderr&quot;: true,
              &quot;Tty&quot;: true,
              &quot;OpenStdin&quot;: true,
              &quot;StdinOnce&quot;: true,
              &quot;Env&quot;: [
                  &quot;PYTHONIOENCODING=UTF-8&quot;,
                  &quot;PYTHON_VERSION=3.10.0a3&quot;,
                  &quot;PYTHON_RELEASE=3.10.0&quot;,
                  &quot;PYTHON_PIP_VERSION=20.3.3&quot;,
                  &quot;PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/5f38681f7f5872e4032860b54e9cc11cf0374932/get-pip.py&quot;,
                  &quot;PYTHON_GET_PIP_SHA256=6a0b13826862f33c13b614a921d36253bfa1ae779c5fbf569876f3585057e9d2&quot;
              ],
              &quot;Cmd&quot;: [
                  &quot;cmd&quot;
              ],
              &quot;Image&quot;: &quot;python:3.10.0a3-windowsservercore-1809&quot;,
              &quot;Volumes&quot;: null,
              &quot;WorkingDir&quot;: &quot;&quot;,
              &quot;Entrypoint&quot;: null,
              &quot;OnBuild&quot;: null,
              &quot;Labels&quot;: {}
          },
          &quot;NetworkSettings&quot;: {
              &quot;Bridge&quot;: &quot;&quot;,
              &quot;SandboxID&quot;: &quot;32cfd271955eaa769cafbf8f22f34c6f95446ec4e3fb3da523b99ca334a67a4d&quot;,
              &quot;HairpinMode&quot;: false,
              &quot;LinkLocalIPv6Address&quot;: &quot;&quot;,
              &quot;LinkLocalIPv6PrefixLen&quot;: 0,
              &quot;Ports&quot;: {},
              &quot;SandboxKey&quot;: &quot;32cfd271955eaa769cafbf8f22f34c6f95446ec4e3fb3da523b99ca334a67a4d&quot;,
              &quot;SecondaryIPAddresses&quot;: null,
              &quot;SecondaryIPv6Addresses&quot;: null,
              &quot;EndpointID&quot;: &quot;&quot;,
              &quot;Gateway&quot;: &quot;&quot;,
              &quot;GlobalIPv6Address&quot;: &quot;&quot;,
              &quot;GlobalIPv6PrefixLen&quot;: 0,
              &quot;IPAddress&quot;: &quot;&quot;,
              &quot;IPPrefixLen&quot;: 0,
              &quot;IPv6Gateway&quot;: &quot;&quot;,
              &quot;MacAddress&quot;: &quot;&quot;,
              &quot;Networks&quot;: {
                  &quot;nat&quot;: {
                      &quot;IPAMConfig&quot;: null,
                      &quot;Links&quot;: null,
                      &quot;Aliases&quot;: null,
                      &quot;NetworkID&quot;: &quot;3983bd268d5212c421ad26a5d935bc3802f9ea6d351f7643a1481fa458f1a545&quot;,
                      &quot;EndpointID&quot;: &quot;4456e1ddf2de9646ee3324dd001394700f334f04fcbb24a772ed9156cbd54a52&quot;,
                      &quot;Gateway&quot;: &quot;172.29.96.1&quot;,
                      &quot;IPAddress&quot;: &quot;172.29.111.58&quot;,
                      &quot;IPPrefixLen&quot;: 16,
                      &quot;IPv6Gateway&quot;: &quot;&quot;,
                      &quot;GlobalIPv6Address&quot;: &quot;&quot;,
                      &quot;GlobalIPv6PrefixLen&quot;: 0,
                      &quot;MacAddress&quot;: &quot;00:15:5d:b9:49:2a&quot;,
                      &quot;DriverOpts&quot;: null
                  }
              }
          }
      }
  ]
  </code></pre>