← All notes

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

Claims

Sources

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.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Compose Specification, Compose Specification; Docker docs, Include. Apache-2.0; Apache-2.0.

Cite this

Permanent ID: iil:note:y2gj1y34

iinventedlight. 2026. "Include another Compose file into the current project." iinventedlight Library, iil:note:y2gj1y34, version of 2026-11-19. https://iinventedlight.com/library/notes/docker-compose-include/. License: CC-BY-4.0.

@misc{iil_note_y2gj1y34,
  author = {{iinventedlight}},
  title = {{Include another Compose file into the current project}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/docker-compose-include/},
  note = {Permanent ID iil:note:y2gj1y34. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-compose-include.md.