The limitations in this setup are that it's manual and hands-on every time a new domain is added. On my website (http://oskarhane.com), I've written some blog posts about how this process could be automated and those posts are my most-read posts of all time.
I was very glad when I found nginx-proxy by Jason Wilder. nginx-proxy solves this problem in a more clever way than me by monitoring Docker events via the Docker Remote API.
Note
You can read more about nginx-proxy on its GitHub page (https://github.com/jwilder/nginx-proxy).
nginx-proxy
comes as a container and we can run it by executing the following command:
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy
We are giving the container our Docker socket, so it can listen for the events we are interested in, which are container starts and stops. We also bind the Docker hosts' port 80 to this new container, making it the entrance container for all incoming web requests...