Can't access container's web server on localhost:80
<p>I can't access container's web server on <code>localhost:80</code> however I can access the webserver on <code>127.0.0.1:80</code>.</p>

<p>What am I doing wrong?</p>

<p>I have docker Version 1.12.2-rc1-beta27 (build: 12496) installed on a Mac.</p>

<p>I ran a container with the command <code>docker run -d -p 80:80 training/webapp python app.py</code>.</p>

<p>The container has the following properties <br /></p>

<pre><code>$docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
baaf4676e548        training/webapp     "python app.py"     22 minutes ago      Up 22 minutes       0.0.0.0:80-&gt;5000/tcp   big_volhard
</code></pre>

<p>My understanding was I should be able to access the website from <code>localhost:80</code>.</p>

<p>This does not work. I get the error message </p>

<pre><code>Could not get any response
</code></pre>

<p>I know that I am using Docker for Mac as I've ran the command <code>env | grep DOCKER</code> and it returns no output.</p>

<p>First update: My <code>/etc/hosts</code> looks like:</p>

<pre><code>127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
</code></pre>

<p>Second update: I've also noticed that when I run the containers using command <code>docker run -d -P training/webapp python app.py</code>, then <code>localhost:autoGeneratedPortNumber</code> works.</p>

<p>Now I'm not sure why both commands (which are more or less the same, the only difference being in one the port number is being specified) have different effects.</p>