Is is possible, using only docker-compose, to mount multiple nginx containers on the same host machine, with each container sharing port 80?
I want to tidy up a system that runs multiple applications on the same host. Each application consists of several linked docker containers tied together with a docker-compose file, and each application is exposed to the world using the host system's nginx as a reverse proxy. So far, so good.
Each time I add a new docker application, I have to add a new nginx.conf file for that application to the host nginx, but I'd prefer bundling the nginx config with the app's docker-compose file as an nginx container, and thus have each app cleanly maintain everything it needs in containers. However, each nginx container needs to listen on port 80, so only the first one can bind. The host nginx can listen for several web applications on port 80, but can multiple nginx instances do the same?
UPDATED :
So it seems this isn't strictly possible. The goal is to have as much application-specific nginx config bundled with the application, so I'm trying a solution where an app still spins up its own nginx container with that logic, while the host nginx handles only url routing to the app nginx. Not sure about performance, but this greatly reduces app entanglement with the host.