Docker Compose Validator – Fix YAML Before Deploy
Lint docker-compose.yml files, highlight missing restart policies, and download a cleaned manifest
No signup • Runs in browser • Free
Docker Compose powers the majority of local development stacks. It is terse, declarative, and right up until a release
candidate – dangerously easy to break with an extra space or a missing colon. Unlike Kubernetes manifests, Compose files
rarely receive schema validation beyond what the Docker CLI reports after a failure. The DevToolBox validator addresses
this gap by performing the same whitespace and key structure checks that docker compose config performs while adding
best-practice guidance for restart policies, resource limits, and env_file usage.
Why lint docker-compose.yml files?
- Indentation rules are strict. Compose files use two-space indentation. Tabs or inconsistent spacing cause CLI
errors such as
found character '\t' that cannot start any token. The validator highlights those lines immediately. - Services need restart policies. Forgetting
restart: unless-stoppedorrestart: on-failureleaves production containers vulnerable to silent exits. Warnings surface services that rely on the default policy. - Resource limits matter. Compose stacks destined for ECS, Swarm, or Nomad benefit from explicit CPU and memory
budgets. The validator detects services missing
deploy.resources.limits. - CI likes normalized files. Prettifying the YAML ensures git diffs stay predictable and merges remain clean.
Recommended validation workflow
- Paste or upload your compose file into the tool.
- Inspect the summary widget to confirm the number of services, volumes, and networks matches expectations.
- Review the Errors & Syntax Issues section for indentation problems, missing colons, or stray characters.
- Handle the Warnings list – typically missing restart policies or absent resource limits.
- Click Prettify YAML to normalize indentation and trailing whitespace, then download the cleaned file for git.
Pair this tool with the .env File Editor to guarantee that each service receives the same set of environment variables across machines.
Command-line validation cheatsheet
# Equivalent of the online validator in your terminal
docker compose config --quiet # exits non-zero if YAML breaks
# Combine with schema validation for Compose v2
docker compose convert > /tmp/out.yml && yq eval '... comments=""' /tmp/out.yml >/dev/null
Additional checks:
- Deprecated keys – Use the validator to find keys such as
container_nameorlinkswhich cause portability problems. Replace them withname:or networking primitives. - Env file drift – When you reference
env_file, ensure those files exist locally. The validator lists them in the summary so you can commit the right sample envs. - Multi-file merges – Compose allows multiple YAML files via
docker compose -f base.yml -f prod.yml up. The tool can still help; paste the merged result fromdocker compose configto check restart policies and limits.