title: docker: mutual access of container and host ports
body: <p>From my docker container I want to access the MySQL server running on my host at 127.0.0.1. I want to access the web server running on my container container from the host.  I tried this:</p>
  
  <pre><code>docker run -it --expose 8000 --expose 8001 --net='host' -P f29963c3b74f
  </code></pre>
  
  <p>But none of the ports show up as exposed:</p>
  
  <pre><code>$ docker ps
  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
  093695f9bc58        f29963c3b74f        "/bin/sh -c '/root/br"   4 minutes ago       Up 4 minutes                            elated_volhard
  $
  $ docker port 093695f9bc58
  </code></pre>
  
  <p>If I don't have <code>--net='host'</code>, the ports are exposed, and I can access the web server on the container.</p>
  
  <p>How can the host and container mutually access each others ports?</p>