title: docker: Says connection refused when attempting to connect to a published port
body: <p>I'm a newbie at docker.  I'm creating a Hello, World example.  All I'm trying to do is bring up Apache in a docker and then view the default website from the host machine.</p>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM centos:latest
  
  RUN yum install epel-release -y
  
  RUN yum install wget -y
  
  RUN yum install httpd -y
  
  EXPOSE 80
  
  ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"]
  </code></pre>
  
  <p>And then I build it:
  <code>&gt; docker build .</code></p>
  
  <p>And then I tag it:</p>
  
  <p><code>docker tag 17283f566320 my:apache</code></p>
  
  <p>And then I run it:</p>
  
  <pre><code>&gt; docker run -p 80:9191 my:apache
  AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
  </code></pre>
  
  <p>It then runs.... </p>
  
  <p>In another terminal window, I attempt to issue the <code>curl</code> command to view the default web site.</p>
  
  <pre><code>&gt; curl -XGET http://0.0.0.0:9191
  curl: (7) Failed to connect to 0.0.0.0 port 9191: Connection refused
  
  &gt; curl -XGET http://localhost:9191
  curl: (7) Failed to connect to localhost port 9191: Connection refused
  
  &gt; curl -XGET http://127.0.0.1:9191
  curl: (7) Failed to connect to 127.0.0.1 port 9191: Connection refused
  </code></pre>
  
  <p>or I try localhost</p>
  
  <p>Just to make sure that I got the port correct, I run this:</p>
  
  <pre><code>&gt; docker ps -l
  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                          NAMES
  5aed4063b1f6        my:apachep      "/usr/sbin/httpd -D F"   43 seconds ago      Up 42 seconds       80/tcp, 0.0.0.0:80-&gt;9191/tcp   angry_hodgkin
  </code></pre>