Compose Validator / Formatter
Validate and format compose.yaml against the official compose-spec schema — entirely on this device.
Checks compose.yaml against the official compose-spec JSON Schema and re-emits it with normalized style — schema truth only, on this device.
Findings appear here after you paste a compose file.
Press ? for shortcuts
Do it offline:$ docker compose -f compose.yaml config
How to use it
- Paste a docker-compose.yaml or compose.yaml. Checking runs as you type; the verdict badge answers within a keystroke pause.
- Read the Findings tab: each row quotes the schema violation verbatim with its line:column anchor — click a row to land the cursor on that line of your input.
- Switch to the Formatted tab for the same document re-emitted at two-space indentation, flow collections expanded to block style, and quoting normalized.
- Copy or download whichever tab you are on — the findings report as text, or the formatted compose.yaml ready to commit.
Paste a compose.yaml and this page checks it against the official compose-spec JSON Schema — the machine-readable grammar the Compose file format publishes — then re-emits it with tidy, consistent style on the Formatted tab. Every finding lands on its exact line and column, formatting keeps your keys in their original order, and the file never leaves this device.
Examples
services:
web:
image: nginx:1.27-alpine
ports:
- "8080:80"
depends_on:
- db
db:
image: postgres:17-alpine
Schema-valid — 2 services
A clean two-service file: ports as a list, depends_on in short form. The digest counts services from the parsed document, and the same file passes docker compose config on a real Docker host — both checkers agree here.
services:
web:
imagee: nginx:1.27-alpine
ports: 8080:80
restart: 42
line 3:5 must NOT have additional properties (/services/web · additionalProperties)
line 4:12 must be array (/services/web/ports · type)
line 5:14 must be string (/services/web/restart · type)
Three findings from one small file: the imagee typo is caught because a service accepts no unknown properties, ports must be a list rather than one scalar, and restart takes a string. Each row anchors where the fix goes — the typo at its key, the wrong types at their values.
services: {web: {image: "nginx:1.27-alpine", ports: ["8080:80"], labels: {app: demo}}}
services:
web:
image: nginx:1.27-alpine
ports:
- 8080:80
labels:
app: demo
A whole service written as one flow mapping comes back in block style at two-space indentation. Key order is untouched, and the quotes around 8080:80 drop because the emitter only quotes where YAML needs it — the value stays a string either way.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
Schema-valid is not a promise it runs
The spec's schema does not require image or build on a service, so a service with neither is green here yet refused by docker compose config, which applies runtime rules on top of the grammar. Treat this page as the spec check and keep the CLI line as the runtime check.
The version key is obsolete, not illegal
A top-level version: passes the schema, and this page adds the parse layer's info note instead of failing. Docker itself now prints an obsolescence warning and ignores the value — delete the line and nothing changes.
Duplicate keys are a warning here, a refusal there
YAML allows a parser to recover from a repeated mapping key, so a doubled image: yields a warning naming the line, and the later value is what gets validated. docker compose config refuses the same file outright — fix the duplicate before shipping.
mem_limit survives as you wrote it
A value like 512m is schema-valid text. Run the same file through docker compose config and it comes back canonicalized to the quoted byte count 536870912 — executed on a real host for this page. The formatter here never rewrites values, so 512m stays 512m.
Formatting is style-only, and provably repeatable
Two-space indentation, flow collections expanded, minimal quoting, comments kept: that is the whole transform. Keys are never sorted, and formatting its own output changes nothing — an idempotence property the engine suite asserts. Generic YAML syntax checking without compose rules lives in the YAML validator instead.
Common errors
Flow sequence in block collection must be sufficiently indented and end with a ] at line 4, column 1:- A YAML syntax error stops everything before schema checking starts — this one is an unclosed [ bracket. The parser's message renders verbatim with a caret frame under it, and the position is 1-based in your pasted text.
No services found — a compose file declares each container under a top-level services: mapping.- The parse layer expects at least one service before schema checking is worth running. A file holding only volumes or networks, or an empty services: {}, answers with this refusal rather than a misleading green badge. One split worth naming: the compose-spec schema itself does not require services at the top level — this refusal is the workbench's own entry gate, not a schema finding.
Input is larger than the 256 KiB limit for this tool.- The cap refuses outright rather than trimming, so the verdict always covers your whole file or none of it. The engine measures UTF-8 bytes precisely and prints 262,144 bytes (256 KB) in its own refusal when the pre-check passes but the byte count does not.
FAQ
Does a green result guarantee docker compose up will accept the file?
No — green means the document matches the compose-spec JSON Schema. Runtime checks layer on top: docker compose config also demands an image or build per service, resolves interpolation, and refuses duplicate keys. The two verdicts were compared on real fixtures against a live Docker host while building this page.
Does the formatter reorder my keys?
Never. The spec defines no canonical key order, so inventing one would change your diffs for zero correctness gain. The re-emit normalizes indentation, collection style, and quoting while keys, comments, and anchors stay where you put them — the engine suite asserts order is preserved byte by byte.
Which schema version is this, and where does it come from?
The compose-spec schema as published in the compose-spec GitHub repository (Apache-2.0), vendored at a pinned commit with its checksum verified by the test suite on every run. Nothing is fetched at runtime — the schema ships with the page and validation happens in a worker on your device.
Keyboard shortcuts
- /
- Focus the input pane.
- ⌘/Ctrl + S
- Download the active tab's artifact.
- ⌘/Ctrl + C
- Copy the active tab while no text is selected.
- ⌘/Ctrl + Shift + C
- Copy the active tab even mid-selection.
- t
- Advance the theme.
- ?
- Open the shortcut help overlay.
- Esc
- Dismiss the topmost overlay.