Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Keep your docker compose.yml portable
Most of you do not want to inject docker-sync specific things into the production
docker-compose.yml to keep it portable. There is a good way to achieve this very cleanly based on docker-compose overrides.
- Create a
docker-compose.yml(you might already have that one) - that is your production file. Do not change anything here, just keep it the way you would run your production environment.
- Create a
docker-compose-dev.yml- this is where you put your overrides into. You will add the external volume and the mount here, also adding other development ENV variables you might need anyway
start your compose using
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up
If you only have macOS- and Linux-based development environments, create
docker-compose-Darwin.yml to put your OS-specific overrides into. Then you may start up your dev environment as:
docker-compose -f docker-compose.yml -f docker-compose-$(uname -s).yml up
A good example for this is a part of the boilerplate project here