Why can't I curl one docker container from another via the host
<p>I really don't understand what's going on here. I just simply want to perform a http request from inside one docker container, to another docker container, via the host, using the <strong>host's public ip</strong>, on a <strong>published port</strong>.</p>

<p>Here is my setup. I have my dev machine. And I have a docker host machine with two containers. CONT_A listens and publishes a web service on port 3000.</p>

<pre><code>DEV-MACHINE

HOST (Public IP = 111.222.333.444)
  CONT_A (Publish 3000)
  CONT_B
</code></pre>

<p><a href="https://i.stack.imgur.com/WSs0N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WSs0N.png" alt="enter image description here"></a></p>

<p><strong>On my dev machine (a completely different machine)</strong></p>

<p>I can curl without any problems</p>

<pre><code>curl http://111.222.333.444:3000 --&gt; OK
</code></pre>

<p><strong>When I SSH into the HOST</strong></p>

<p>I can curl without any problesm</p>

<pre><code>curl http://111.222.333.444:3000 --&gt; OK
</code></pre>

<p><strong>When I execute inside CONT_B</strong></p>

<p>Not possible, just timeout. Ping is fine though...</p>

<pre><code>docker exec -it CONT_B bash
$ curl http://111.222.333.444:3000 --&gt; TIMEOUT
$ ping 111.222.333.444 --&gt; OK
</code></pre>

<p><strong>Why?</strong></p>

<p>Ubuntu 16.04, Docker 1.12.3 (default network setup)</p>