title: Configuring nginx to listen on port a docker container is already running on
body: <p>I have a docker container that is listening on port 80 (and 443) running on a server and accepting request for a sub-domain <code>https://&lt;subdomain1&gt;.&lt;domain&gt;.com</code></p>
  
  <p>Now I need to deploy another container on the same server and accept connections for another subdomain <code>https://&lt;subdomain2&gt;.&lt;domain&gt;.com</code>. The problem is that the container for <code>subdomain1</code> is already running on port 80. For the new one, I can choose a different port on the host.</p>
  
  <p>Is it possible to put nginx 'before' the container so it can redirect the traffic to different dockers accordingly? Also, ideally I wouldn't want to commit the old docker container and run it on a new port. I can stop and restart though.</p>