Most Compose mistakes show up as a confusing error halfway through docker compose up. I would rather find them first, and docker compose config does exactly that: it validates the file and shows what Docker will really run. This guide uses only the options listed in Docker’s own documentation, and it changes nothing on your system.
- Time
- 3 min
- Steps
- 6
- Updated
- 19 Nov 2026
You will learn
- Validate only
- See the file as Docker sees it
- List things instead of reading YAML
- Check the variables
- Save the result
What you need
Docker with the Compose plugin (the docker compose command) and a folder with a compose.yaml. Per the Docker docs, config parses, resolves and renders the Compose file in canonical form.
Step 1 of 6: Validate only
Run this in the folder with your Compose file:
docker compose config --quiet
--quiet (-q) only validates and prints nothing. No output and exit code 0 means the file parses. An error means you found a problem before it cost you a restart. I like this in a shell alias or a pre-commit habit.
Step 2 of 6: See the file as Docker sees it
Without options, the command prints the resolved model:
docker compose config
It merges the files you pass with -f, resolves variables and expands short notation into the long form. This is the quickest way to see why an override file or an .env value does not do what you expected. To pass several files:
docker compose -f compose.yaml -f compose.override.yaml config
Step 3 of 6: List things instead of reading YAML
The command can print one name per line, which suits scripts and a quick look:
docker compose config --services
docker compose config --images
docker compose config --volumes
docker compose config --networks
--images is useful before an update: it tells you which images the next pull will fetch. --variables prints the variables the model uses and their default values.
Step 4 of 6: Check the variables
Unset variables are a classic source of quiet bugs. The output of docker compose config shows the values after interpolation, so a missing one shows up as an empty string. Two related options:
docker compose config --environment
docker compose config --no-interpolate
--environment prints the environment used for interpolation, and --no-interpolate leaves the ${VAR} placeholders alone. Be careful when you share output: the resolved config can contain secrets from your environment, so look at it before you paste it in a forum or a chat.
Step 5 of 6: Save the result
Use -o to write the resolved file to disk, for example to compare before and after a change:
docker compose config -o resolved.yaml
Then use diff on two versions. The output is a snapshot for reading, and I would not use it as your new source file.
Step 6 of 6: How to know it worked, and how it breaks
A good run prints the resolved YAML, or nothing with --quiet. If it fails, the message names the field or the file. The usual causes are tab characters instead of spaces, a variable with no default that your shell does not export, and an override file merged in a different order than you thought. This command only validates the Compose model, so it will not tell you whether a port is free or an image exists. For that you still need docker compose up.
