Validating...
Paste your docker-compose.yml above and click Validate.
What Is Docker Compose?
Docker Compose is a tool for defining and running multi-container applications using a single YAML file — typically named docker-compose.yml or compose.yml. Instead of running a chain of long docker run commands, you declare every service, its image, environment variables, ports, volumes, and inter-service dependencies in one place.
A single docker compose up command starts your entire stack — web server, database, cache, worker — in the correct order based on depends_on relationships. This makes Compose the standard tool for local development and CI pipelines across the industry.
The Compose Spec (the modern standard, maintained at compose-spec.io) supersedes the older versioned formats (v2, v3). Files using the Compose Spec omit the top-level version: key entirely. All Docker Engine versions from 20.10 onwards support the Compose Spec natively.
What This Validator Checks
YAML Syntax
Detects malformed YAML — bad indentation, unclosed quotes, invalid scalars — before any semantic checks.
Service Definitions
Flags services that define neither image nor build, which will always fail at runtime.
depends_on Cycles
Runs a depth-first search to find circular dependencies that would hang docker compose up indefinitely.
Port Format
Validates port mapping syntax — host:container, ranges, and /tcp and /udp protocols.
Named Volumes
Warns when a named volume is referenced in a service but not declared in the top-level volumes: block.
Null Environment Variables
Info-level notice when an env var has a null value — Docker will source it from the host shell at startup.
Port Mapping Syntax Reference
Docker Compose supports several port mapping formats. All of the following are valid:
| Format | Meaning |
|---|---|
| "80:80" | Host port 80 → container port 80 |
| "8080:80" | Host port 8080 → container port 80 |
| "80" | Container port 80, random host port |
| "9000-9010:9000-9010" | Port range mapping (must be same width) |
| "53:53/udp" | UDP port mapping |
| "127.0.0.1:80:80" | Bind to specific host IP (localhost only) |
Always quote port mappings that start with a number in YAML — e.g. "80:80" not 80:80 — to avoid the colon being parsed as a YAML key separator.
Common Docker Compose Mistakes
Missing image and build
A service with no image: or build: cannot start. Docker has nothing to run. This is the most common first-time error.
Undeclared named volumes
Using my-data:/var/lib/data in a service requires a matching my-data: entry under the top-level volumes: block. Without it, Docker Compose will error on startup in strict mode or behave unexpectedly.
depends_on does not wait for readiness
depends_on only waits for the container to start — not for the service inside to be ready. Use healthcheck + condition: service_healthy for true readiness gating.
Keeping the version: key
The version: key is obsolete in the Compose Spec and is ignored by Docker Compose v2. Keeping it causes a deprecation warning. Remove it entirely in new files.
Frequently Asked Questions
Does this validator work with Docker Swarm configs?
What is the difference between named volumes and bind mounts?
Why does my valid-looking YAML fail validation here?
What does "sources from shell" mean for null environment variables?
Related Developer Tools
JSON Formatter & Validator
Format, minify, and validate JSON with error location
RegEx Tester & Debugger
Test and debug regular expressions with match highlighting
Cron Job Expression Parser
Parse cron expressions into plain English with next run times
CSS Minifier & Beautifier
Minify or format CSS with VS Code syntax highlighting