Working with multiple Docker Compose files stored in different directories could get nasty real quick especially if you hit that edge case scenario. So, what’s the lesson here?!
Prerequisites
- Docker
- Docker Compose
Solution
While working with multiple Docker Compose files, these files are getting merged into a single one with the last one having the priority to overwriting anything.
Now, regarding bind mounts and using relative paths, things will get messy as all paths are relative to the first Compose file specified with -f
. This is required since override files need not be valid Compose files. More about it here.
As for alternatives, extends looks like a decent one.
Conclusion
In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.