Skip to content

Docker Compose

The Docker Compose adapter copies Compose files to the runner, runs docker compose up -d, captures published port metadata, and records enough state to run docker compose down -v later.

Required runner capabilities:

CapabilityWhy it is required
ExecRuns Docker Compose commands on the runner.
FileCopyCopies Compose files and supporting files to the runner workdir.

The runner must have Docker and Docker Compose available.

Supported source modes:

Source modeSupportedBehavior
filesYesEach file is copied to the runner workdir and passed to Compose with -f.
embeddedNoNot supported.
pathNoNot supported.

Example:

components:
web:
type: docker-compose
runner: local
source:
files:
compose.yml: ./docker-compose.yml

Multiple files are passed to Compose in manifest map iteration order as -f arguments. Docker Compose merges those files into one effective project before applying.

FieldTypeDefaultDescription
commandstringdocker composeCompose command to execute. Use docker-compose for the legacy standalone binary.
flagslist of strings[]Extra flags appended after the command and before -f files.

Example:

config:
command: docker compose
flags:
- --ansi
- never

Component env values are passed to Compose. Orch also sets:

VariableDescription
COMPOSE_PROJECT_NAMEStable Orch-managed project name derived from environment ID and component name.
ORCH_ENV_IDCurrent Orch environment ID.
ORCH_WORKDIRComponent workdir on the runner.

Docker Compose does not have user-defined outputs. The adapter emits reserved _meta outputs automatically for published service ports.

For a service named web publishing container port 80:

env:
WEB_PORT: "${web.outputs._meta.ports.services.web.80}"
WEB_BINDING: "${web.outputs._meta.bindings.services.web.80}"
OutputExample valueDescription
_meta.ports.services.<service>.<containerPort>64313Host port parsed from Docker Compose’s published binding.
_meta.bindings.services.<service>.<containerPort>0.0.0.0:64313Raw binding returned by docker compose port.

The _meta namespace is reserved for Orch-generated operational metadata. It does not need to be declared in outputs.

Port metadata is captured after up -d by running:

Terminal window
docker compose ... port <service> <containerPort>

These outputs describe Docker Compose’s merged project, not the individual Compose files where a service or port was declared.

Apply does the following:

  1. Copies with files to the component workdir.
  2. Copies Compose source files to the component workdir.
  3. Runs docker compose -f ... -p <project> up -d.
  4. Captures _meta port and binding outputs for declared Compose service ports.
  5. Stores command, compose files, environment, project name, and workdir in component state.

Orch warns when fixed host ports are declared because they can conflict across concurrent environments.

Destroy reads component state and runs:

Terminal window
docker compose -f ... -p <project> down -v

Destroy uses the command, files, project name, environment, and workdir captured at apply time.