The Docker Compose config command validates Compose files and prints the final configuration without deploying the application. It is a practical dry run for checking overrides and YAML processing. section 10.2 section 10.4
Use config to:
- Inspect how multiple Compose files merge. section 10.2
- Confirm that files are valid before deployment. section 10.2
- Verify YAML extension fields after they are merged into service definitions. section 10.4
- Check override precedence: files listed on the right override files listed on the left. section 10.2
Preview an override
Run docker compose -f ./todo-list/docker-compose.yml -f ./todo-list/docker-compose-v2.yml config. The output contains the complete merged Compose file, including the overridden image tag. Output is alphabetically ordered, with networks before services. section 10.2
# browse to the image-gallery folder under ch10/exercises: cd ../image-gallery # check config for the production override: docker compose ` -f ./docker-compose.yml ` -f ./docker-compose-prod.yml ` config
Run config against a production override to inspect the resulting configuration without starting the image-gallery application. section 10.4
