What is considered "best practices" for serving a a docker container from a specific domain name?
For example:
- Container1 runs App A on port 8080, and accessed via AwesomeAppA.com
- Container2 runs App B on port 8090, and accessed via AwesomeAppB.com
You can then, for example:
- Have your container expose the port used by Gunicorn/uWSGI, for example, and use Nginx on the docker host to handle the proxy.
- But you can also have your container run Nginx internally and use HAProxy.
But which is better? Are there other preferred options, or is it really down to personal preference?
Option 1 conforms to the single-responsibility principle, and allows you to run your 1 application in the container and let the host handle the proxy. It also allows Nginx to handle SSL, but requires additional setup and provisioning besides just "docker run".