title: Docker on Windows: how to connect to container from host using container IP?
body: <p>I have</p>
  
  <ul>
  <li>Windows 10</li>
  <li>Docker for Windows V. 1.12.5 Rev. 9503, which does not rely on boot2docker or VirtualBox anymore.</li>
  </ul>
  
  <p>I have a number of JBoss instances running in Docker images (172.18.0.2 is a database):</p>
  
  <ul>
  <li>instance 1: name: jboss-eap, IP: 172.18.0.3</li>
  <li>instance 2: name: jboss-eap-arquillian, IP: 172.18.0.4</li>
  </ul>
  
  <p>that shall be running at the same time. Each JBoss instance exports e.g. its 8787, 8080 and 8443 ports.</p>
  
  <p>I have also created a bridged network:
  docker network create --driver bridge --subnet 172.18.0.0/24 bridged_network</p>
  
  <p>Currently, I have set up a local port forwarding such that the host can access the various services using a prefix (e.g. when accessing instance 1's port 8080, the host uses localhost:28080 to connect). But that's quite error prone.</p>
  
  <p>Now, I want to access those ports from the host using the container's IP, e.g. calling 172.18.0.4:8080 (next step: using the host name: jboss-eap-arquillian:8080).
  While this is working smoothly from container to container, I haven't been able to set it up to connect from the host.</p>
  
  <p>There is Windows network interface (type: DockerNAT), having IP 10.0.75.1, but it's possible that I've created it manually (unsure ... been trying for quite some time now). But that is helpful when binding the container's port to this device, e.g. docker run ... -p 10.0.75.1:8080:8080. I can then call the service using 10.0.75.1:8080, but that does not help me for the 2nd container.</p>
  
  <p>I've also tried to use the Docker's host network device, but that 
  a. seems to work for only one machine
  b. I cannot statically set the IP, which is needed for JUnit tests running a static configuration.
  Note: I cannot rely on the network DHCP to assign an IP upon startup, since I change my network (and therefore the DHCP) frequently, resulting in an unfixed IP again.</p>
  
  <p>So basically I'm looking for a way to set up the network/container in such a way, that I can call the service provided by the container (e.g. on port 8080) using the container IP (e.g. 172.18.0.3 for instance 1) from the host using 172.18.0.3:8080.</p>