title: REST request from one docker container to another fails
body: <p>I have two applications, one of which has a RESTful interface that is used by the other. Both are running on the same machine.</p>
  
  <p>Application A runs in a docker container. I am running it using the command line:</p>
  
  <pre><code>docker run -p 40000:8080 --name AppA image1
  </code></pre>
  
  <p>When I test Application B outside a docker container (in other words, before it is dockerized) Application B successfully executes all RESTful requests and receives responses without problems.</p>
  
  <p>Unfortunately, when I dockerize and run Application B within a container:</p>
  
  <pre><code>docker run -p 8081:8081 --name AppB image2
  </code></pre>
  
  <p>whenever I attempt to send a RESTful request to Application A, I get the following:</p>
  
  <pre><code>Connect to localhost:40000 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
  </code></pre>
  
  <p>Of course, I also tried making Application B connect using my machine's IP address. When I do that, I get the following failure:</p>
  
  <pre><code>Connect to 192.168.1.101:40000 failed: No route to Host
  </code></pre>
  
  <p>Has anyone seen this kind of behavior before? What causes an application that communicates perfectly well with another dockerized application outside a docker container to fail to communicate with that same dockerized application once it is itself dockerized???</p>
  
  <p>Someone please advise...</p>