title: Make container accessible only from localhost
body: <p>I have Docker engine installed on Debian Jessie and I am running there container with nginx in it. My "run" command looks like this:</p>
  
  <pre><code>docker run -p 1234:80 -d -v /var/www/:/usr/share/nginx/html nginx:1.9
  </code></pre>
  
  <p>It works fine, problem is that now content of this container is accessible via <code>http://{server_ip}:1234</code>. I want to run multiple containers (domains) on this server so I want to setup reverse proxies for them. </p>
  
  <p>How can I make sure that container will be only accessible via reverse proxy and not directly from <code>IP:port</code>? Eg.:</p>
  
  <pre><code>http://{server_ip}:1234  # not found, connection refused, etc...
  http://localhost:1234  # works fine
  </code></pre>
  
  <p><strong>//EDIT:</strong> Just to be clear - I am not asking how to setup reverse proxy, but how to run Docker container to be accessible only from localhost.</p>