Skip to content
pbb.io/blog

TIL you can include other files via Docker Compose

August 21, 2024
1 min read
Docker

Docker Compose has an include directive that lets you split your setup into multiple files:

# compose.yml
include:
- path: ./compose/temporal/compose.yml
env_file:
- ./compose/temporal/.env
- path: ./compose/compose-db.yml
services:
app:
depends_on:
- db
- temporal

Each included file is resolved relative to its own directory, so paths within it just work. The included services can then be referenced directly via depends_on or networking. It also works recursively.

Back to posts

Docker
Phil-Bastian Berndt

Phil-Bastian Berndt
Tech Lead at Naymspace