About docker compose validator
Check a docker-compose.yml for YAML errors and common mistakes before running docker compose up.
It looks for
- Invalid YAML and wrong indentation.
- Services without an image or build.
- Badly formed port mappings.
A worked example
A file with a service that has neither image nor build, a port written as 80:80:80, or a tab used for indentation is flagged with the line number. Fix the problems here, then run docker compose config to see how Docker itself reads the file.
Common findings
- Wrong indentation under services.
- Environment variables listed with a missing equals sign.
- Volume names used but not declared under volumes.
What it cannot check
It cannot tell whether an image exists or whether a port is already in use on your machine. Those errors only appear when you start the stack.
