- Intermediate
- Docker Compose
How it works
Keep compose.yaml close to production, put the developer comforts (bind mounts, nodemon, a published database port, NODE_ENV=development) in compose.override.yaml, and deploy with an explicit production file that never loads it.
What breaks
A plain docker compose up on the server silently loads the override: production then serves the source folder through nodemon, with the database open to the internet. The bug only shows up there, never on the laptop.
In a terminal
docker compose up -d
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.