Below you will find pages that utilize the taxonomy term “Docker Compose”
Articles
read more
Defining multiple similar services with Docker Compose
For my new workshop - “Building Autonomous Services” - I needed to define several Docker containers/services with more or less the same setup:
- A PHP-FPM process for running the service’s PHP code.
- An Nginx process for serving static and dynamic requests (using the PHP-FPM process as backend).
To route requests properly, every Nginx service would have its own hostvcname. I didn’t want to do complicated things with ports though - the Nginx services should all listen to port 80. However, on the host machine, only one service can listen on port 80. This is where reverse HTTP proxy Traefik did a good job: it is the only service listening on the host on port 80, and it forwards requests to the right service based on the host name from the request.