# Docker Compose Modularity with \`include\`

**URL:** <https://forums.docker.com/t/docker-compose-modularity-with-include/137062>\
**Category:** Announcements\
**Created:** [August 3, 2023, 6:17am UTC](https://forums.docker.com/t/docker-compose-modularity-with-include/137062 "2023-08-03T06:17:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajeetraina](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ajeetraina/32/34719_2.png) [@ajeetraina](https://forums.docker.com/u/ajeetraina)\
**Post date:** [August 3, 2023, 6:17am UTC](https://forums.docker.com/t/docker-compose-modularity-with-include/137062/1 "2023-08-03T06:17:35Z")

</div>

With `include` support in the latest Compose 2.20 version, Docker Compose makes it easier to modularize complex applications into sub-compose files. This capability allows application configuration to be simpler and more explicit. It also helps to reflect the engineering team responsible for the code in the config file organization. With each team able to reflect in configuration the way it depends on other’s work, there’s a natural approach to `compose.yaml` files organization.

`include:`

`../database/compose.yaml`

`services:`

` ` `webapp:`

` ` `depends_on:`

` ` `- database `

Learn More: [Docker Compose Modularity with `include` | Docker](https://www.docker.com/blog/improve-docker-compose-modularity-with-include/)

---

<div class="post-metadata">

**Author:** ![ajeetraina](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ajeetraina/32/34719_2.png) [@ajeetraina](https://forums.docker.com/u/ajeetraina)\
**Post date:** [August 3, 2023, 6:18am UTC](https://forums.docker.com/t/docker-compose-modularity-with-include/137062/2 "2023-08-03T06:18:33Z")

</div>

Here’s a simple example:

## Demonstrating the power of Compose Include

## Pre-requisite

- Install Docker Compose v2.20.x

```auto
  wget https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-linux-x86_64
  mv docker-compose-linux-x86_64 docker-compose
  chmod +x docker-compose

```

```auto
  docker-compose version
  Docker Compose version v2.20.2

```

## Getting Started

## Clone the repository

```auto
 git clone https://github.com/ajeetraina/compose-include/
 cd compose-include

```

## Run the Services

```auto
 docker-compose -f web.yaml up

```

```auto
docker-compose -f web.yaml ps 
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
root-database-1 postgres:12 "docker-entrypoint.s…" database 10 minutes ago Up 2 minutes 5432/tcp
root-web-1 nginx:latest "/docker-entrypoint.…" web 10 minutes ago  

```
