Docker Compose Validator
Validate your docker-compose.yml for syntax errors, missing fields, and best practice violations. Checks services, ports, volumes, networks, depends_on, and environment variables.
What This Validator Checks
Structure: verifies version or services are present and that version is a quoted string. Services: each service must define image or build. Ports & Volumes: validates format strings like 8080:80 and ./data:/app/data. References: checks that depends_on and networks references point to defined entries. Best practices: flags deprecated links and unquoted port numbers.
Parse the docker-compose.yml content into a structured object using a lightweight YAML parser
Verify required top-level keys — version (must be a quoted string) and/or services block
Each service must define image or build — check ports (HOST:CONTAINER), volumes (source:target), and environment format
Validate depends_on targets exist as services, and network references match top-level networks definitions
Categorize findings as pass (valid), warning (best practice), or error (invalid config) with actionable messages
Spec: Docker Compose Specification (compose-spec.io), Compose V2/V3 file reference