- Intermediate
- Docker Compose
How it works
docker compose up reads compose.yaml and compose.override.yaml on its own. docker compose -f compose.yaml -f compose.prod.yaml up skips the override and applies the production file instead. Single values are replaced, maps are merged, and lists like ports add up.
What breaks
Because ports add up, an override cannot take away a port published by the base file: use !reset [] or move the port out of the base. docker compose config shows the merged result before anything runs.
In a terminal
docker compose -f compose.yaml -f compose.prod.yaml config
docker compose -f compose.yaml -f compose.prod.yaml up -d
See it break, then fix it
Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.