Docker Engine 29 reference · Docker Compose
docker compose config Command (Docker CLI)
Validate the Compose files and print the final configuration after merging overrides and interpolating variables.
Docker Engine 29
Syntax
docker compose config [OPTIONS] [SERVICE...]
Parameters
| Parameter | Description |
|---|---|
-q |
Only validate; print nothing if valid. |
--services |
List service names. |
--format json |
Output JSON. |
Examples
printf 'services:\n api:\n image: alpine:3.24\n environment:\n LEVEL: ${LOG_LEVEL:-info}\n' > compose.yaml
LOG_LEVEL=debug docker compose config --format json | python3 -c 'import json,sys; print(json.load(sys.stdin)["services"]["api"]["environment"])'
Output
{'LEVEL': 'debug'}Run this on your computer — see “Get Started” for setup.
printf 'services:\n api:\n image: alpine:3.24\n ports: [notaport]\n' > compose.yaml
docker compose config -q 2>&1 | head -1 | cut -c1-80 || true
Output
invalid containerPort: notaport
Run this on your computer — see “Get Started” for setup.
Related
docker compose up· Create and start every service of a Compose project; -d runs in the background and --wait returns once services are healthy.- Environment Files, Profiles and Overrides · tutorial