Docker Compose Validator & Formatter

Paste a docker-compose.yml and find out what is wrong before docker compose up does: specification errors, services, volumes and networks that do not exist, port clashes and risky settings, each with its line number. Then format it without losing your comments.

Compose specification schemaCross-reference checksPort clash detectionKeeps commentsRuns in your browser
docker-compose.yml
Comments are kept.
4 errors found· 2 warnings, 1 note

How to use the Compose validator

Five steps, all in the browser.

  1. Paste the file

    Paste your docker-compose.yml or compose.yaml into the editor. It is checked as you type, entirely in your browser, so nothing is uploaded. That matters for files that hold connection strings.

  2. Fix errors first

    Errors are things docker compose up would refuse or fail on: invalid YAML, keys the Compose specification does not allow, or references to services, volumes and networks that do not exist. Click any issue to jump to its line.

  3. Then read the warnings

    Warnings will run but cause trouble later: an image with no pinned tag, a password typed into environment, a privileged container. Notes cover things like the obsolete version key.

  4. Format it

    Format re-indents to two spaces, normalises quoting and, if you leave the box ticked, puts each service's keys in the conventional order. Unlike most formatters, it keeps your comments.

  5. Confirm on your machine

    Run docker compose config locally before you commit. It also resolves .env variables and include files, which a browser cannot see.

What it checks

A YAML validator only tells you the file parses. Most broken Compose files parse fine. The problems are a key Compose does not recognise or a reference to something that is not there, so those are the checks that matter.

The Compose specification

Every key and value is checked against the official Compose specification schema, the same one Docker Compose validates against.

This catches misspelled keys like restrat or enviroment, a mapping where a list is required, and values of the wrong type, with the path and line of each.

Services that reference each other

Every depends_on must name a service in the file, and a service cannot depend on itself.

A condition: service_healthy dependency on a service with no healthcheck is flagged too. Compose waits for it to be healthy forever, and the dependent service never starts.

Volumes, networks, secrets and configs

Named volumes, networks, secrets and configs used by a service must be declared at the top level of the file.

A volume written as data:/data is a named volume, not a folder. If you meant a folder on the host, write ./data:/data. This is one of the most common Compose mistakes.

Host port clashes

Two services publishing the same host port are reported, including the bind address and protocol.

The second service would fail with "port is already allocated". If the clash is with a program outside the file, the port-already-allocated guide linked below shows how to find it.

Risky settings

Images with no tag or latest, plain-text passwords, tokens and keys in environment, privileged: true, container_name combined with replicas, and ports with network_mode: host.

None of these stop Compose from starting, which is why they slip into production. Each warning says what to do instead.

Docker Compose questions

How do I validate a docker-compose.yml file?

Paste it into the validator above. It checks YAML syntax, validates every key against the Compose specification, and checks references between services, volumes and networks. Locally, docker compose config does the same and also resolves .env variables.

How do I format a Docker Compose file?

Paste it and press Format. The formatter re-indents to two spaces, normalises quotes, and can put each service's keys in the usual order (image, build, ports, volumes, and so on). It keeps your comments, which most YAML formatters strip.

Is the version key still needed in docker-compose.yml?

No. Current Docker Compose follows the Compose specification and ignores the top-level version key, printing a warning that it is obsolete. You can delete it.

What is the difference between docker-compose.yml and compose.yaml?

Both work. compose.yaml is the preferred name in the Compose specification, and Docker Compose looks for it first, but docker-compose.yml is still fully supported. The format is the same.

Is my Compose file uploaded anywhere?

No. Parsing, validation and formatting all run in your browser. That said, avoid pasting real secrets into any website; reference them as ${VARIABLE} from an .env file instead.

Related tools and guides