title: Cannot contact docker container on Windows host
body: <p>tl;dr summary of the problem:</p>
  
  <ul>
  <li>Application launches successfully within container, binds to 127.0.0.1:8080 within the container, and successfully services web requests, but only within the container</li>
  <li>docker ps -a confirms that port 8080 is being exposed</li>
  <li>I cannot communicate with the application from the host using the container's actual IP address when I request <a href="http://[Container" rel="nofollow noreferrer">http://[Container</a> IP address]:8080 </li>
  <li>The host is running Windows 10</li>
  <li>The Windows Firewall is completely disabled for troubleshooting</li>
  </ul>
  
  <p>To troubleshoot I have created the simplest possible application to run in a dockers container, an F# / Suave application like so:</p>
  
  <pre><code>open Suave
  [&lt;EntryPoint&gt;]
  let main args =
  
      startWebServer defaultConfig (Successful.OK "Hello World!")
      0
  </code></pre>
  
  <p>Which works fine, returning a simple "Hello World!" when I run it locally.</p>
  
  <p>To containerize the app I have followed the instructions at "<a href="https://docs.docker.com/engine/examples/dotnetcore/" rel="nofollow noreferrer">Dockerize a .NET Core application</a>" which instructs me to run the container like </p>
  
  <pre><code>$ docker run -d -p 8080:80 --name myapp aspnetapp
  </code></pre>
  
  <p>I cannot connect to the "website" at <a href="http://localhost:80" rel="nofollow noreferrer">http://localhost:80</a> nor <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a>, which apparently is a common problems for Docker users running Windows.  <strong>However the solution that seems to have fixed this problem for every other Windows user on the internet, running</strong> </p>
  
  <pre><code>docker inspect myapp
  </code></pre>
  
  <p><strong>and then hitting the resulting IPAddress, does not work either.</strong>  I get:</p>
  
  <p><a href="https://i.stack.imgur.com/tyqn6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tyqn6.png" alt="enter image description here"></a></p>
  
  <p>Hitting both <a href="http://172.17.0.2:80" rel="nofollow noreferrer">http://172.17.0.2:80</a> and <a href="http://172.17.0.2:8080" rel="nofollow noreferrer">http://172.17.0.2:8080</a> in Chrome gives me "Site can't be reached."</p>
  
  <p>Also worth noting, when I run </p>
  
  <pre><code>docker logs myapp
  </code></pre>
  
  <p>The only line is </p>
  
  <pre><code>[17:43:21 INF] Smooth! Suave listener started in 73.476ms with binding 127.0.0.1:8080
  </code></pre>
  
  <p>As a guess, I have also tried </p>
  
  <pre><code>ipconfig
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gby48.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gby48.png" alt="enter image description here"></a></p>
  
  <p>and then hitting the IP address of the Docker NAT adapter, but this also results in an unreachable site.</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Another observation which might or might not be relevant:  Many online tutorials suggest that under Windows you need to directly connect to the IP Address of the container, and to get that IP address by running</p>
  
  <pre><code>docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" myapp
  </code></pre>
  
  <p>which for me, always yields: <strong></strong></p>
  
  <p>When I run a vanilla</p>
  
  <p>docker inspect myapp</p>
  
  <p>the resulting JSON is not structured exactly like the recommended query.  I get a <strong>bridge</strong> node, but no <strong>nat</strong> node:</p>
  
  <p><a href="https://i.stack.imgur.com/OR3Ha.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OR3Ha.png" alt="enter image description here"></a></p>