Docker: cannot open port from container to host
<p>I'm using <code>Docker for Mac</code>. I have a container that run a server, for example my server is run on port 5000. I have exposed this port on <code>Dockerfile</code></p>

<p>When my container is running, I connect to this container and check and if this server is working or not by running below command and see that it returns data (a bunch of html and javascript)</p>

<pre><code>wget -d localhost:5000
</code></pre>

<p>Notes, I start this container and also publish port outside by command:</p>

<pre><code>docker run -d -p 5000:5000 &lt;docker_image_name&gt;
</code></pre>

<p>But at docker host (is my mac and running El Capitan), I open chrome and go to address <code>localhost:5000</code>. It doesn't work. Just a little note, if I go to any arbitrary port such as <code>localhost:4000</code> I see error message from chrome such as:</p>

<pre><code>This site can’t be reached
localhost refused to connect.
</code></pre>

<p>But error message for <code>localhost:5000</code> is:</p>

<pre><code>The localhost page isn’t working
localhost didn’t send any data.
</code></pre>

<p>So it seems I have configured work "a little" but something wrong. Please tell me how to fix this.</p>