Sometimes, we want to run our applications in different environments that need specific configuration settings. Docker Compose provides a handy capability to address exactly this issue.
Let's make a specific sample. We can define a base Docker Compose file and then define environment-specific overrides. Let's assume we have a file called docker-compose.base.yml with the following content:
version: "2.4"
services:
web:
image: fundamentalsofdocker/ch11-web:2.0
db:
image: fundamentalsofdocker/ch11-db:2.0
volumes:
- pets-data:/var/lib/postgresql/data
volumes:
pets-data:
This only defines the part that should be the same in all environments. All specific settings have been taken out.
Let's assume for a moment that we want to run our sample application on a CI system, but there we want to use different settings for...