dck renders one service per repository. Some products run as one compose project
spread over several repositories — an API, a web app, workers and a database that
share one COMPOSE_PROJECT_NAME, one network and some volumes. This page covers the
dck.toml keys and the compose conventions (since v0.3.3) that make that work without
hand-editing what dck renders.
Everything here is additive: a repository that sets none of these keys renders exactly as before.
- Several repositories each run
dck initand render their own service, but the services must live in one compose project (they reach each other by service name, share named volumes, or onedocker compose psshows the whole product). - The stack already exists as hand-written compose files (often run as root, with YAML anchors for workers) and you are moving it to dck.
A single repository with a single service needs none of this.
[compose] project wins over COMPOSE_PROJECT_NAME in the environment or in
docker/local/.env (dck passes it with -p on every compose call); only
dck --project NAME overrides it. dck config says where the project came from.
[compose]
project = "acme-platform" # the rendered top-level `name:`By default dck init writes name: <compose_project_prefix><repo-slug>, which gives
every repository its own project. Set project to the same value in every repository
of the stack so they render the same name:. The launcher then uses it ahead of
COMPOSE_PROJECT_NAME (environment, then docker/local/.env) and the file's name:
(launcher.md).
Each dck service keeps its state in a named volume (v0.3.2): the sshd host key,
~/.ssh (authorized_keys, known_hosts, copied keys), gh auth, Herdr client state
and config, and shell history. Compose prefixes volume names with the project name, so
repositories that share one project and keep the default state would share one
state volume — one host key for several machines, one known_hosts, one gh login.
[compose]
project = "acme-platform"
state_volume = "state-api" # one per service: state-web, state-worker, ...dck init --state-volume NAMEwrites the key.dck doctorflags a shared project whose state volume is not per service (doctor.md,compose.shared_with).- Changing it starts the service with a fresh state volume (a re-pinned host key, a new gh login) and leaves the old volume in place; remove it by hand when you no longer need it.
[compose]
networks = ["acme-net"] # networks that already exist; dck never creates themThree sources can name an external network:
| Source | Where |
|---|---|
[compose] networks |
the repository's dck.toml |
network |
your host profile (config.md) |
x-dck-merge.networks |
the user block (below) |
All of them end up in one top-level networks: mapping, each declared once with
external: true. dck never writes two networks: keys. Create the network once on
the host (docker network create acme-net) before the first dck up.
ssh_port and each [ports] entry accept an integer (as before) or a string holding a
compose port expression:
ssh_port = "${API_SSH_PORT:-22540}" # host port only; the container port is 22
[ports]
web = 4321 # integer: same port on both sides
django = "${DJANGO_RUNSERVER_HOST_PORT:-8000}:8000"
node = "5001:3000"
public = "0.0.0.0:9000:9000"| Entry | Rendered |
|---|---|
ssh_port = "${API_SSH_PORT:-22540}" |
"127.0.0.1:${API_SSH_PORT:-22540}:22" |
web = 4321 |
"127.0.0.1:4321:4321" |
django = "${DJANGO_RUNSERVER_HOST_PORT:-8000}:8000" |
"127.0.0.1:${DJANGO_RUNSERVER_HOST_PORT:-8000}:8000" |
node = "5001:3000" |
"127.0.0.1:5001:3000" |
public = "0.0.0.0:9000:9000" |
"0.0.0.0:9000:9000" (verbatim) |
web = "${WEB_HOST:-8000}:${WEB_PORT:-8000}" |
"127.0.0.1:${WEB_HOST:-8000}:${WEB_PORT:-8000}" |
Either side of a string may be a number or a ${VAR} / ${VAR:-default} expression;
a string needs its container side ("HOST:CONTAINER"), except a plain number, which
maps to itself. A string is rendered verbatim and prefixed with <bind>: (127.0.0.1 by default)
unless it already starts with a host IP (1.2.3.4: or [...]:). Naming a host IP
other than loopback exposes that port beyond this machine — the same decision as a
non-loopback bind (SECURITY.md).
Compose substitutes ${VAR:-default} itself. For the host port dck ssh, Herdr and
dck doctor connect to, the launcher resolves the expression the same way: the
variable from the environment, then from the compose directory's .env
(docker/local/.env), then the default.
[build]
context = "../.." # relative to the compose file's directory (docker/local/)
dockerfile = "docker/local/vue/Dockerfile" # relative to the repository; optionalThe default context is ./<service> (docker/local/<service>/). With
context = "../.." the context is the repository root, and the dockerfile path is
computed relative to it, so the project layer of the Dockerfile can
COPY requirements/ ... from the root. The COPY lines of dck's own block follow the
context (COPY docker/local/<service>/dck/...); keep a .dockerignore at the root
when the context is the whole repository, or every build sends it all.
dockerfile names a Dockerfile several services share (a web app's dev server,
storybook and a satellite built from docker/local/vue/Dockerfile). dck's managed
blocks go into that file and its vendored dck/ directory goes next to it
(docker/local/vue/dck/); the service's .env stays in docker/local/<service>/.
Without context, the context is the Dockerfile's directory.
Most stacks need compose keys dck does not render (depends_on, healthcheck, a
command) or extra entries in keys it does (env_file, environment, volumes,
networks). They go in a user block inside the dck service mapping of
docker/local/docker-compose.yaml, which dck never rewrites:
services:
# >>> dck:service >>>
api:
build: ...
# ... dck-rendered keys ...
# >>> user:api >>>
depends_on: # dck does not render it: a plain key
- postgres
healthcheck:
test: ["CMD", "true"]
x-dck-merge: # dck renders these: merged into its keys
env_file:
- path: ./django/.env
required: false
- ./postgres/.env
environment:
DOCKER_DEV_ENV: "1"
volumes:
- logins:/home/dev/.logins
- ../../..:/workspaces:ro # sibling checkouts, read-only
- sqlite_volume:/app/src/databases
networks:
- acme-net
extra_hosts:
- "metadata.local:127.0.0.1"
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# <<< user:api <<<
# <<< dck:service <<<Placement. The markers are # >>> user:<service> >>> and
# <<< user:<service> <<<, at service-key indentation (four spaces), inside the
service mapping, right before # <<< dck:service <<<. You add the block; dck init
never inserts one, so a file without it renders exactly as before.
Plain keys or x-dck-merge.
| Key | Goes | Effect |
|---|---|---|
a key dck does not render (depends_on, healthcheck, stop_grace_period, ...) |
plain, directly in the block | compose reads it as is |
a key dck renders (env_file, environment, volumes, networks, command, ...) |
under x-dck-merge: |
merged into dck's value at dck init |
A plain key that dck also renders is an error, with the fix "move it under x-dck-merge".
Merge rules for x-dck-merge:
| Value | Rule | Examples |
|---|---|---|
| list | your items are appended after dck's | volumes, env_file, ports, networks, extra_hosts, depends_on, cap_add |
| map | merged; your entry wins on the same key | environment, labels |
| scalar | yours replaces dck's; dck doctor reports the override |
working_dir, init, user |
| replace-only keys | yours replaces dck's in any form (string, flow list [...] or block list), never appended; reported like a scalar |
command, entrypoint, healthcheck, build, image, restart, platform, stop_signal |
Named volumes in x-dck-merge.volumes that are not dck's own (logins,
sqlite_volume above) are declared once in the single top-level volumes:
(compose-managed, {}). Networks named there join the single top-level networks:
(external: true).
After editing the block, run dck init. The merge happens at render time;
dck up and dck rebuild warn (does not reflect dck.toml or its user block — run: dck init) and dck doctor reports it as a problem while the rendered file does not
reflect the block or dck.toml. The doctor also lists what the block overrides
(user block overrides dck's command, environment.DCK_SSH).
dck owns the single top-level volumes: and networks: (one key each). The file's
other services — a database, a cache, workers — declare their own data volumes and
networks in top-level user sub-blocks inside dck's blocks, which dck keeps
verbatim, or through dck.toml:
# >>> dck:volumes >>>
volumes:
state-api: {}
# >>> user:volumes >>>
local_postgres14_data: {}
local_postgres14_data_backups: {}
dynamodb_data:
external: true
# <<< user:volumes <<<
# <<< dck:volumes <<<
# >>> dck:networks >>>
networks:
acme-net:
external: true
name: acme-net
# >>> user:networks >>>
backend: {}
# <<< user:networks <<<
# <<< dck:networks <<<[compose]
volumes = ["local_pgvector", "cursor_data"] # declared compose-managed ({}), exact namesNames are kept exactly, so compose keeps mounting the volumes the stack already has
(<project>_local_postgres14_data): they are never renamed or recreated. The markers
sit at two-space indentation, right before dck's closing marker; add the
dck:networks block yourself when the file has none (dck adds it only when it
declares an external network). A name declared twice — in a sub-block and by dck
(its state volume, the agents layer's volumes, [compose] volumes, [compose] networks, the host profile's network) — is refused with the fix. A volume or network
that x-dck-merge names and a sub-block declares is the sub-block's to declare (an
external volume, a network with options); dck does not declare it again.
Markers are all-or-nothing. A compose file with some dck markers but not all, or a user block without its end marker, is an error naming the missing marker and the fix. dck never appends a block at the end of the file.
Workers and other services built from the same image are user-owned services outside
the dck markers. Hand-written stacks often defined them with a YAML anchor
(<<: *api). An anchor copies everything, including dck's published ports and the
sshd wiring, so two containers fought over one host port. Use extends with
!reset:
services:
# >>> dck:service >>>
api:
...
# <<< dck:service <<<
api-worker:
extends: api
command: ["celery", "worker"]
ports: !reset []
depends_on: !reset []
volumes: !override
- ../..:/app:cachedextends also copies dck's volumes, including the state volume: without
volumes: !override, the worker would share the service's sshd host key, ~/.ssh,
gh login and Herdr state, and dck doctor reports the state volume as shared with it.
List the mounts the worker needs (the repository, a data volume; add the SSH agent
socket bind if it needs git over SSH).
Place satellites after # <<< dck:service <<<, still inside services:. extends
with !reset needs Docker Compose 2.24 or newer; dck doctor checks the version
and names the minimum.
A workspace starts a second instance of a dev service — <svc>satellite — in its own
compose project, with its own ports. Started with plain docker compose, it gets none
of dck's host steps: no authorized key (Herdr cannot attach), no copied keys, no git
identity, no host-profile accounts, and an empty state volume (gh and Dailybot logged
out). Start it through dck instead (launcher.md).
Define the satellite in the main compose file, after # <<< dck:service <<< (so
extends: <svc> finds the service in the same file), or in an overlay file, where
extends names the file:
apisatellite:
extends: api # in an overlay: extends: {file: docker-compose.yaml, service: api}
profiles: [satellite] # never started by a plain `dck up`
ports: !override
- "127.0.0.1:${API_WS_SSH_PORT:-22541}:22"
- "127.0.0.1:${API_WS_PORT:-8100}:8000"
volumes: !override # its own mounts: never the main state volume
- ../..:/app:cached
- state-api:/home/dev/.dck/volumes/stateThe satellite runs in its own compose project, so state-api there is
<satellite project>_state-api, not the main one's (acme-platform_state-api). Name
the volume the file declares (the service's [compose] state_volume); the mount point
stays ~/.dck/volumes/state.
What the repository's script calls — instead of
docker compose -p <ws> -f … up -d apisatellite:
# docker.sh satellite.up <ws>
dck --project "acme-$ws" --compose-file docker/local/docker-compose.yaml \
--compose-file "docker/local/docker-compose.$ws.yaml" --service apisatellite \
up --seed-state-from acme-platform_state-api --label "API · $ws"
# docker.sh satellite.down <ws>
dck --project "acme-$ws" --compose-file docker/local/docker-compose.yaml \
--compose-file "docker/local/docker-compose.$ws.yaml" --service apisatellite downThe user block of the main service reaches the satellite through extends (it is
merged into the main service's keys at dck init); the satellite's own block, when it
needs one, is plain compose under its own service. The satellite's .env files are the
main service's (extends copies env_file).
The primary through an extra overlay. A script that recreates the main service
itself with another file (a backend overlay behind a preview proxy) calls dck in PRIMARY
mode — --compose-file without --service — instead of plain compose, so the host steps
stay (launcher.md):
# docker.sh primary.backend
dck --compose-file docker/local/docker-compose.yaml \
--compose-file docker/local/docker-compose.primary-backend.yaml up --recreate apiBy default a repository wires and installs the CLIs chosen at onboarding ([agents] clis) for everyone. When teammates use different CLIs, opt into the advanced mode:
[agents] supported = "all" with clis = [] (or a minimal set) wires every CLI —
volumes, host profiles — installed or not, and each developer picks what their image
installs in their gitignored docker/local/.env (DCK_AGENT_CLIS="grok opencode", or
INSTALL_GROK_CLI=true), or for every repository in the host profile ([agents] clis /
clis_extra); then dck rebuild. The .env.example dck init writes explains the
repository's mode and its options (config.md).
A user block, a satellite or any hand-written part of the file that reaches the host —
a bind mount outside the repository, privileged, cap_add, the Docker socket — makes
dck up, start, restart, build and rebuild stop with exit status 5 until you review it and pass
--trust (or DCK_TRUST=1). The reasons are printed on stderr; bash dev.sh also says
so on stdout (dev.sh: dck refused to up (exit 5) …), so a script or tool that
discards stderr still sees why nothing started. After reviewing:
DCK_TRUST=1 bash dev.sh up. Exit 5 is also how dck refuses a compose file whose
markers need a fix (see Markers are all-or-nothing).
dck containers run as dev (uid 1000). Named volumes created by an older container
that ran as root keep root ownership, so the new container cannot write to them. Fix
each affected path once, from docker/local/:
docker compose run --rm --user root api chown -R 1000:1000 /app/src/databases
dck up --recreateRepeat the chown for every volume path the old container wrote to (one per
service and path).
[agents]
clis = ["claude", "codex"]
presets = [] # subset of ["classic", "providers"]presets selects the coding-agents-kit (ak) alias presets. With the key absent,
both classic and providers apply, as before; new renders write presets = []
(no presets). See layers.md.
[agents]
node_first = true # off by defaultWhen the image's node is older than the pinned major, the agents layer installs its
own Node in /opt/dck/node and leaves the repository's node first on PATH. A
repository whose own tooling needs that newer Node sets node_first = true: the
rendered Dockerfile puts /opt/dck/node/bin first (ENV PATH, DCK_NODE_FIRST=1) and
the login profile does the same for SSH and Herdr shells.
dev_sh = false # or: dck init --no-dev-shFor a repository that already ships a dev.sh (often the stack's own script): dck init neither creates nor touches it. Call dck from that script instead.
The user block is the repository's own compose content. dck merges it into the
rendered file, and dck up's preflight reviews the result like any other repository
compose content (SECURITY.md):
- Host-reaching keys need
--trust. Bind mounts of host paths outside the repository (the../../..:/workspaces:romount above is one),privileged,cap_add, host namespaces, devices or the Docker socket makeup,start,restart,buildandrebuildrefuse (exit 5) until you pass--trust(orDCK_TRUST=1) after reading what they list. With--compose-file(satellites, PRIMARY mode) the files compose actually runs are the ones checked. - Prefer read-only mounts for shared sources (
:ro): the container then reads sibling checkouts without being able to change them. env_filecontents reach the container and its SSH sessions. Every variable compose passes in is written to the dev user's~/.dck/env.sh(0600) sosshand Herdr sessions see it (entrypoint.md). List only files whose secrets that container should hold.- Extra networks widen reachability. Every container on a shared network can
reach the others' ports, including sshd on port 22 (public-key login for
devonly). - Ports with a host IP (
"0.0.0.0:9000:9000") are published beyond loopback; keep the default prefix unless the port must be reachable from other machines.