Docker Compose Validator

Paste a docker-compose.yml (or upload the file) and check it before you hand it to docker compose up. The validator parses the YAML with a real parser so syntax errors point at the exact line, then runs a set of Compose-specific checks that catch the mistakes that fail at deploy time or bite you later: a service with neither an image nor a build, a port string that is not a valid mapping, a named volume or network referenced but never declared, a depends_on typo that points at a service that does not exist, an invalid restart policy, and the deprecated keys (version, links, extends) that Compose v2 quietly ignores. It also flags the security traps — privileged: true, dangerous capabilities, host ports below 1024 and bind mounts of sensitive paths such as /var/run/docker.sock. Everything runs in this tab; your compose file is never uploaded.

100% private. The YAML is parsed and every check runs with JavaScript in this browser tab. Your compose file — including any environment values, secrets references and internal hostnames it contains — is never sent to this website or to anyone else, and nothing is executed.

Try it with a sample

Your compose file

Files are read with the browser’s FileReader — they are never uploaded.

Results

Waiting for input

Service inventory

Parse a file to see each service at a glance.

How to use it

Drop your docker-compose.yml into the editor, or click Load from file… and pick the file — the browser reads it locally and fills the box. Then press Validate. You can also start from one of the two samples above: the clean stack shows what a passing file looks like, and the broken one is deliberately full of the mistakes this tool exists to catch, so you can read each finding and see why it fired.

Findings are grouped by severity. An error is something Compose will refuse or that breaks the stack — a malformed port, an undefined volume, a depends_on pointing at a service that does not exist. A warning is something that will run but is a bad idea or a deprecated shortcut. A note is informational — for example that both image and build are set, or that an env_file is referenced (its contents are read at runtime, so they cannot be checked here). When the YAML itself does not parse, the first finding is the syntax error with the line number, and the semantic checks are skipped because there is no structure to inspect.

How it works

The file is first handed to js-yaml, the same MIT-licensed parser used across the JavaScript ecosystem. A syntax failure carries a mark with a line and column, which is surfaced as-is. A successful parse yields a plain object, and the checks operate on that structure: the top-level services mapping, each service’s keys, and the top-level volumes and networks blocks that named references must point into.

Port entries are parsed into their parts — optional IP, host port, container port and protocol, with support for ranges like 8080-8090:80-81. Host ports that collide across services (same port and protocol) are reported as errors because the second bind will fail at startup. Volume references are split on the first colon: a source beginning with /, . or ~ is treated as a host bind mount, anything else as a named volume that must be declared at the top level. Network and depends_on references are checked against the declared set, which is what turns a one-character typo into a clear message instead of a runtime failure.

Because the checks run on the parsed object rather than the raw text, they report the service and the key path (for example db → ports[1]) instead of a line number — line numbers are reserved for genuine YAML syntax errors, where the parser can give them to you precisely.

A worked example

Consider this snippet — load it with the Common mistakes sample and press Validate:

services:
  web:
    image: nginx:latest
    ports:
      - "not-a-port"
    volumes:
      - missing-data:/data
    depends_on:
      - databse
  db:
    image: postgres:16
    privileged: true

The validator reports, among others: an error on web → ports[0] because "not-a-port" is not a valid port mapping; an error that the named volume missing-data is used by web but never declared under a top-level volumes: block; an error that depends_on references databse, which is not a service (the obvious typo of db); and a warning that db runs with privileged: true, giving the container full access to every host device. Fix those four and the file is in a state you can trust before it ever reaches docker compose up.

Common mistakes this catches

MistakeWhy it matters
No image or buildA service with neither has nothing to run; Compose fails immediately.
Malformed port"8080:80/xxx", a missing container port or an out-of-range number breaks the bind at startup.
Duplicate host portTwo services publishing the same host port and protocol — the second one cannot bind.
Undeclared named volumeA reference like data:/var/lib/x with no top-level volumes: entry is rejected by modern Compose.
Undeclared networkA service network not present in the top-level networks: block fails validation.
depends_on typoPointing at a service that does not exist is almost always a misspelling and fails the build.
Invalid restart policyOnly no, always, on-failure[:N] and unless-stopped are accepted.
Deprecated keysTop-level version, per-service links and extends are ignored or limited in Compose v2.
Security trapsprivileged: true, SYS_ADMIN/ALL capabilities, host ports below 1024 and mounts of /var/run/docker.sock or other sensitive paths.

Luke Keam
Spot a bug or want a custom utility built? I'd love to hear from you. Get in touch
Luke Keam | techgeek.biz