<p>Since Windows use a tiny VM called MobyLinux, the port mapping will happen with tiny VM and not with Windows Host. If you are not reachable from Windows Host to Docker MobyVM, check windows events for possible error. For more networking related information, please see -</p>

<p><a href="https://docs.docker.com/engine/userguide/networking/" rel="nofollow noreferrer">https://docs.docker.com/engine/userguide/networking/</a></p>

CC BY-SA 3.0
2018-01-10T06:24:56.640Z
2018-01-10T06:24:56.640Z
prashant tyagi
<p>The tomcat is reachable on port 8080 instead of 8888 when the following is defined in the question</p>

<blockquote>
<pre><code>docker run -it --rm -p 8888:8080 tomcat:8.0
</code></pre>
</blockquote>

<p><a href="https://docs.docker.com/engine/reference/commandline/run/" rel="nofollow noreferrer">Documentation</a></p>

<blockquote>
  <p>Publish or expose port (-p, –expose)</p>

<pre><code>$ docker run -p 127.0.0.1:80:8080 ubuntu bash
</code></pre>
  
  <p>This binds port 8080 of the container to port 80 on 127.0.0.1 of the
  host machine. The Docker User Guide explains in detail how to
  manipulate ports in Docker.</p>

<pre><code>$ docker run --expose 80 ubuntu bash
</code></pre>
  
  <p>This exposes port 80 of the container without publishing the port to
  the host system’s interfaces.</p>
</blockquote>

<p>Based on the documentation, the first port is the internal port, i.e. 8080 and the second one, i.e. 8888 the external or exposed one.</p>

CC BY-SA 3.0
2017-12-10T10:35:04.097Z
2017-12-10T10:40:22.183Z
2017-12-10T10:40:22.183Z
030
<p><strong>Given:</strong></p>

<ol>
<li>Windows 10 / 64 bit</li>
<li>Docker edge 17.11-ce-win40</li>
</ol>

<p><strong>Experiment:</strong> </p>

<pre><code>docker run -it --rm -p 8888:8080 tomcat:8.0
</code></pre>

<p>Expected behaviour:</p>

<ul>
<li>If all network settings are okay, Tomcat must be reachable locally and from outside on the host port 8888.</li>
</ul>

<p><strong>Observed behaviour:</strong></p>

<ul>
<li><code>curl localhost:8080</code> inside container proves Tomcat to be up and running</li>
<li>ERR_EMPTY_RESPONSE locally/from outside</li>
<li>Flipping Windows Firewall leads to the question whether vpnkit should be allowed, allowing leads to no change</li>
<li>nmap from outside reveals port open</li>
<li>telnet is possible as well but no further interaction </li>
<li><code>docker inspect -f '{{ .NetworkSettings.Networks.nat.IPAddress }} &lt;CONTAINER_ID&gt;</code> outputs <code>&lt;no value&gt;</code></li>
<li>find <code>ipconfig /all</code> output below</li>
</ul>

<p><strong>Further debugging</strong></p>

<pre><code>ipconfig /all [excerpt]


   Hostname  . . . . . . . . . . . . : foo
   Primäres DNS-Suffix . . . . . . . : foo.com
   Knotentyp . . . . . . . . . . . . : Hybrid
   IP-Routing aktiviert  . . . . . . : No
   WINS-Proxy aktiviert  . . . . . . : No
   DNS-Suffixsuchliste . . . . . . . : foo.com

Ethernet-Adapter vEthernet (DockerNAT):

   Verbindungsspezifisches DNS-Suffix:
   Beschreibung. . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physische Adresse . . . . . . . . : 00-15-5D-48-8F-A4
   DHCP aktiviert. . . . . . . . . . : No
   Autokonfiguration aktiviert . . . : Yes
   Verbindungslokale IPv6-Adresse  . : fe80::e93b:535c:4ea5:84cf%18
   IPv4-Adresse  . . . . . . . . . . : 10.0.75.1
   Subnetzmaske  . . . . . . . . . . : 255.255.255.0
   Standardgateway . . . . . . . . . :
   DNS-Server  . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS über TCP/IP . . . . . . . : Active

Ethernet-Adapter Ethernet:

   Verbindungsspezifisches DNS-Suffix: foo.com
   Beschreibung. . . . . . . . . . . : Realtek USB GbE Family Controller
   Physische Adresse . . . . . . . . : D4-81-D7-57-AC-C6
   DHCP aktiviert. . . . . . . . . . : Yes
   Autokonfiguration aktiviert . . . : Yes
</code></pre>

CC BY-SA 3.0
2018-02-13T11:43:30.260Z
Same issue here but only recently.  Have you solved it?
zeroid
CC BY-SA 3.0
2018-02-13T12:16:29.853Z
no i.e. no more observed
Ta Mu
CC BY-SA 4.0
2019-10-04T08:41:14.383Z
First of all, I think this should be a comment instead of an answer, but since I'm not allowed to comment... > Based on the documentation, the first port is the internal port, i.e. 8080 and the second one, i.e. 8888 the external or exposed one. It is exactly the other way around. They are binding the containers internal port 8080 to port 80 on your local host, which in turn allows other computers to connect to port 80 of your computer using your computer's IP address.
armin
<docker><windows><firewall>
Debug Docker networking and Windows 10 firewall
Ta Mu
# Debug Docker networking and Windows 10 firewall

(Asked by: username_0 on 2017-12-05)

Given:

Windows 10 / 64 bit
Docker edge 17.11-ce-win40

Experiment: 
docker run -it --rm -p 8888:8080 tomcat:8.0

Expected behaviour:

If all network settings are okay, Tomcat must be reachable locally and from outside on the host port 8888.

Observed behaviour:

curl localhost:8080 inside container proves Tomcat to be up and running
ERR_EMPTY_RESPONSE locally/from outside
Flipping Windows Firewall leads to the question whether vpnkit should be allowed, allowing leads to no change
nmap from outside reveals port open
telnet is possible as well but no further interaction 
docker inspect -f '{{ .NetworkSettings.Networks.nat.IPAddress }}  outputs 
find ipconfig /all output below

Further debugging
ipconfig /all [excerpt]


   Hostname  . . . . . . . . . . . . : foo
   Primäres DNS-Suffix . . . . . . . : foo.com
   Knotentyp . . . . . . . . . . . . : Hybrid
   IP-Routing aktiviert  . . . . . . : No
   WINS-Proxy aktiviert  . . . . . . : No
   DNS-Suffixsuchliste . . . . . . . : foo.com

Ethernet-Adapter vEthernet (DockerNAT):

   Verbindungsspezifisches DNS-Suffix:
   Beschreibung. . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Physische Adresse . . . . . . . . : 00-15-5D-48-8F-A4
   DHCP aktiviert. . . . . . . . . . : No
   Autokonfiguration aktiviert . . . : Yes
   Verbindungslokale IPv6-Adresse  . : fe80::e93b:535c:4ea5:84cf%18
   IPv4-Adresse  . . . . . . . . . . : 10.0.75.1
   Subnetzmaske  . . . . . . . . . . : 255.255.255.0
   Standardgateway . . . . . . . . . :
   DNS-Server  . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS über TCP/IP . . . . . . . : Active

Ethernet-Adapter Ethernet:

   Verbindungsspezifisches DNS-Suffix: foo.com
   Beschreibung. . . . . . . . . . . : Realtek USB GbE Family Controller
   Physische Adresse . . . . . . . . : D4-81-D7-57-AC-C6
   DHCP aktiviert. . . . . . . . . . : Yes
   Autokonfiguration aktiviert . . . : Yes

**Tags:** docker, windows, firewall

> **Comments:**
> **username_1**: Same issue here but only recently.  Have you solved it?  
> **username_0**: no i.e. no more observed  
> **username_2**: First of all, I think this should be a comment instead of an answer, but since I'm not allowed to comment... > Based on the documentation, the first port is the internal port, i.e. 8080 and the second one, i.e. 8888 the external or exposed one. It is exactly the other way around. They are binding the containers internal port 8080 to port 80 on your local host, which in turn allows other computers to connect to port 80 of your computer using your computer's IP address.  

---

## 2 answers

### Answer by username_3 on 2018-01-10. Score: 2

Since Windows use a tiny VM called MobyLinux, the port mapping will happen with tiny VM and not with Windows Host. If you are not reachable from Windows Host to Docker MobyVM, check windows events for possible error. For more networking related information, please see -

<https://docs.docker.com/engine/userguide/networking/>


---

### Answer by username_4 on 2017-12-10. Score: 1

The tomcat is reachable on port 8080 instead of 8888 when the following is defined in the question

docker run -it --rm -p 8888:8080 tomcat:8.0


Documentation

Publish or expose port (-p, –expose)
$ docker run -p 127.0.0.1:80:8080 ubuntu bash

This binds port 8080 of the container to port 80 on 127.0.0.1 of the
  host machine. The Docker User Guide explains in detail how to
  manipulate ports in Docker.
$ docker run --expose 80 ubuntu bash

This exposes port 80 of the container without publishing the port to
  the host system’s interfaces.

Based on the documentation, the first port is the internal port, i.e. 8080 and the second one, i.e. 8888 the external or exposed one.


---

