Docker compose multiple files in different directories and relative paths

Jul 16, 2023 · 1 min read · Post a comment

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?!


  • Docker
  • Docker Compose


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.


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.