---
source: https://iinventedlight.com/library/notes/docker-compose-include.md
title: "Include another Compose file into the current project"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Compose Specification); Apache-2.0 (Docker docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Compose Specification, Compose Specification; Docker docs, Include. Apache-2.0; Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: Docker Compose include"
tags: [docker, compose, include, modular]
client: Librarian
sources:
  - id: S1
    title: "Compose Specification"
    publisher: Compose Specification
    url: https://raw.githubusercontent.com/compose-spec/compose-spec/master/spec.md
    accessed: 2026-11-19
    license: "Apache-2.0"
  - id: S2
    title: "Include"
    publisher: Docker docs
    url: https://docs.docker.com/compose/how-tos/multiple-compose-files/include/
    accessed: 2026-11-19
    license: "Apache-2.0"
---
# Include another Compose file into the current project
**Answer:** The `include` top-level section is used to define a dependency on another Compose application. Each path listed in `include` is loaded as an individual Compose application model, with its own project directory, so relative paths resolve there. Resource definitions are then copied into the current Compose application model.

## How include is applied

Compose displays a warning if resource names conflict and does not try to merge them. `include` is evaluated after the Compose file or files that define the current application have been parsed and merged, so conflicts are detected. `include` applies recursively, so an included Compose file that declares its own `include` section triggers those other files to be included as well. Volumes, networks, or other resources from the included file can be used for cross-service references, such as `depends_on`.

## Short syntax and versions

The Docker how-to requires Docker Compose 2.20.3 and later. The short syntax only defines paths to other Compose files. Each included file uses its parent folder as the project directory. An optional `.env` file can define default values for interpolation. The local project's environment can override those values.

| include | compose |
|---|---|
| project directory | Relative paths resolve in the included tree |
| name conflict | Warning; Compose does not merge those resources |
| recursive include | Nested include sections are included as well |
| short syntax | A list of paths, with optional `.env` defaults |

## See also

- [docker-compose-basics](https://iinventedlight.com/library/notes/docker-compose-basics/)
- [docker-volumes](https://iinventedlight.com/library/notes/docker-volumes/)
- [docker-bind-mounts-tmpfs](https://iinventedlight.com/library/notes/docker-bind-mounts-tmpfs/)

## Claims

- id: C1
  claim: The include top-level section loads another Compose application into the current model.
  source: S1
  evidence: "the 'include' top-level section is used to define"

- id: C2
  claim: Include is recursive when an included file declares its own include section.
  source: S1
  evidence: "'include' applies recursively so an included Compose file"

- id: C3
  claim: Docker documents include as requiring Compose 2.20.0 or later.
  source: S2
  evidence: "Docker Compose 2.20.3 and later"

## Sources

- [S1] Compose Specification. Compose Specification. https://raw.githubusercontent.com/compose-spec/compose-spec/master/spec.md . License: Apache-2.0. Accessed 2026-11-19.

- [S2] Include. Docker docs. https://docs.docker.com/compose/how-tos/multiple-compose-files/include/ . License: Apache-2.0. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Compose Specification, Compose Specification; Docker docs, Include. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
