Home Explore Blog Models CI



docker

content/manuals/compose/how-tos/multiple-compose-files/_index.md
80fc73edfe5885de0d944131c67df943b8a4b29a706169dc00000003000006a4
---
description: General overview for the different ways you can work with multiple compose
  files in Docker Compose
keywords: compose, compose file, merge, extends, include, docker compose, -f flag
linkTitle: Use multiple Compose files
title: Use multiple Compose files
weight: 80
aliases:
- /compose/multiple-compose-files/
---

This section contains information on the ways you can work with multiple Compose files. 

Using multiple Compose files lets you customize a Compose application for different environments or workflows. This is useful for large applications that may use dozens of containers, with ownership distributed across multiple teams. For example, if your organization or team uses a monorepo, each team may have their own “local” Compose file to run a subset of the application. They then need to rely on other teams to provide a reference Compose file that defines the expected way to run their own subset. Complexity moves from the code in to the infrastructure and the configuration file.

The quickest way to work with multiple Compose files is to [merge](merge.md) Compose files using the `-f` flag in the command line to list out your desired Compose files. However, [merging rules](merge.md#merging-rules) means this can soon get quite complicated.

Docker Compose provides two other options to manage this complexity when working with multiple Compose files. Depending on your project's needs, you can: 

- [Extend a Compose file](extends.md) by referring to another Compose file and selecting the bits you want to use in your own application, with the ability to override some attributes.
- [Include other Compose files](include.md) directly in your Compose file.


Chunks
89ca4812 (1st chunk of `content/manuals/compose/how-tos/multiple-compose-files/_index.md`)
Title: Working with Multiple Docker Compose Files
Summary
This section describes different ways to work with multiple Compose files in Docker Compose. Using multiple Compose files allows for customization of applications for different environments or workflows, especially useful for large applications with distributed ownership. The simplest method is merging Compose files using the `-f` flag, but this can become complex. Docker Compose offers two additional options: extending a Compose file by referencing and overriding parts of another, and including other Compose files directly.