docker,

Multiple Docker Compose files with some overlap between them

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

Let’s say you have two Docker Compose files that needs to be up and running, however they have some overlapping services and configs. How does that work though?!

Prerequisites

  • Docker
  • Docker Compose

Solution

When using multiple Docker Compose files with some overlap, Docker Compose merges the configurations from the files in the order they are specified, overriding any duplicate configurations encountered. It does not duplicate or create any resources that are already defined.

Must be pointed out that the configurations from the last file take precedence even when there are conflicting image:tags for the same service.

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.