See Automated Nginx Reverse Proxy for Docker for why you might want to use
To run it:
docker run -d \ -p 80:80 \ -v /var/run/docker.sock:/tmp/docker.sock \ joaodubas/nginx-proxy
Then start any containers you want proxied with an environment variable
docker run -e VIRTUAL_HOST=foo.bar.com ...
Provided your DNS is setup to forward
foo.bar.com to the a host running
nginx-proxy, the request will be routed to a container with the
environment variable set.
If your container exposes multiple ports, nginx-proxy will default to the
service running on port 80. If you need to specify a different port, you can set
VIRTUAL_PORT environment variable to select a different one. If your
container only exposes one port and it has a
VIRTUAL_HOST environment variable
set, that port will be selected.
If you need to support multiple virtual hosts for a container, you can separate
each entry with commas. For example,
foo.bar.com,baz.bar.com,bar.com and each
host will be setup the same.
To make it easier to also use this image to serve static content, one can mount
additional configurations files in the folder