Home › Developer Tools › Docker Compose Validator

Docker Compose Validator

Paste a docker-compose.yml or compose.yaml to check it instantly. The validator catches YAML syntax errors, unknown or misspelled keys, wrong value types, broken links between services, networks, volumes and secrets, host port clashes and deprecated options, each with the line number and a fix.

Last updated:

Loading the YAML engine…
    Advertisement
    Advertisement

    How to use the Docker Compose Validator

    1. Paste your Compose file into the editor, upload docker-compose.yml, or load one of the samples.
    2. Read the summary: it shows whether the file is valid and how many errors, warnings and tips were found.
    3. Click an issue to jump to the matching line; errors are marked in red and warnings in amber.
    4. Fix the problems in the editor; the file is checked again automatically as you type.
    5. Filter or copy the report to share it in a pull request or ticket, then run docker compose config locally for a final check.

    Common Docker Compose errors and how to fix them

    Most broken Compose files fail for a handful of reasons. The table lists the messages you are likely to see here, what causes them and the usual fix.

    ProblemTypical causeFix
    Bad indentationA key is indented with a different number of spaces than its siblings, or a tab was usedUse spaces only and keep every key of one service at the same column
    Unknown keyA typo (enviroment, depend_on) or a key placed at the wrong levelUse the suggested spelling; custom keys must start with x-
    Named volume not declareddata:/app/data refers to a named volume that is missing from the top-level volumes:Add volumes: {data: {}}, or write ./data:/app/data for a bind mount
    Network not declaredA service joins a custom network that is not definedAdd it under top-level networks:; only default exists automatically
    Service has neither image nor buildThe service only sets ports or environmentAdd image: name:tag or build: ./folder
    Host port already publishedTwo services map the same host port, for example both use "80:…"Give each a different host port, or bind them to different IPs
    Circular dependencyA depends on B and B (directly or indirectly) depends on ARemove one direction; use healthchecks and retries instead of mutual waits
    Invalid durationinterval: 30 seconds or timeout: 5Write a number with a unit: 30s, 1m30s, 500ms
    Boolean expectedprivileged: yes is a string in YAML 1.2Use true or false

    Deprecated and legacy Compose keys

    The Compose Specification replaced the separate version 2 and version 3 file formats. A few older options still work but are no longer recommended:

    • version: obsolete. Compose v2 ignores it and warns about it. Delete the line; the newest features are always available.
    • links: legacy. Every service on a shared network can already reach the others by service name, for example db:5432. Use depends_on for start order and network aliases for extra hostnames.
    • external_links: legacy. Attach both projects to the same external network instead.
    • external: {name: …}: deprecated. Write name: shared_net and external: true on the network or volume.

    Tips for a healthy Compose file

    • Pin image tags (postgres:16-alpine rather than postgres or :latest) so every deploy runs the same version.
    • Add a healthcheck to databases and caches and use condition: service_healthy in depends_on, so dependent services start only when they can connect.
    • Keep secrets out of the file: reference ${DB_PASSWORD} from an untracked .env file, or use the top-level secrets section and *_FILE variables.
    • Do not publish database ports unless you need them from the host; containers on the same network reach each other without ports. If you do, bind to 127.0.0.1.
    • Avoid container_name unless another tool needs a fixed name; it blocks scaling and can clash between projects.
    • Run docker compose config after editing to see the final file with variables and override files merged.

    Frequently asked questions

    What does this Docker Compose validator check?

    It parses the file as YAML, then compares every key and value with the Compose Specification used by Docker Compose v2: allowed keys, value types, enums such as restart policies and depends_on conditions, and duration formats. After that it checks the relationships between parts of the file, for example that every network, named volume, secret and dependency a service uses is actually defined.

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

    No. Docker Compose v2 follows the Compose Specification, which treats the top-level version key as obsolete. Compose ignores it and prints a warning that the attribute is obsolete, so you can delete the line. The validator reports it as a deprecated key.

    Why does it say my named volume is not declared?

    A volume entry such as db_data:/var/lib/mysql uses a named volume because the source has no slash or dot. Named volumes must be listed in the top-level volumes section (an empty entry like db_data: is enough). If you meant a folder on your computer, write it as a path such as ./db_data:/var/lib/mysql.

    How is this different from docker compose config?

    docker compose config is the authoritative check because it runs the real Compose engine, resolves environment variables and merges override files. This tool works without Docker installed, explains each problem in plain language, adds best-practice tips and never sends the file anywhere. Use both: this one while editing, docker compose config before you deploy.

    Does the validator replace ${VARIABLES} with values?

    No. Variables are left as written because their values come from your shell or .env file. The validator checks that each interpolation is well formed, for example ${VAR}, ${VAR:-default} or ${VAR:?message}, and skips type checks on values that contain a variable.

    Why should port mappings be quoted?

    YAML 1.1 parsers read an unquoted value such as 22:22 as a base-60 number. Docker Compose v2 uses YAML 1.2 and handles it correctly, but other tools in your pipeline may not. Quoting every mapping, for example "8080:80", avoids the problem everywhere.

    Is my Compose file uploaded?

    No. The validator and the YAML parser run in your browser. The file is never sent to a server, so it is safe to check files that contain internal hostnames or credentials.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    Docker Compose GeneratorBuild a docker-compose.yml with a form: services, ports, volumes, env, healthchecks and presets.YAML Validator & FormatterValidate, format and minify YAML, and convert YAML to JSON or back.Docker Run to Compose ConverterConvert docker run commands to docker-compose.yml, or a compose file back to docker run.Dockerfile LinterLint a Dockerfile for best practices: pinned tags, apt cleanup, non-root USER and layer count.QR Code GeneratorMake QR codes for links, Wi-Fi, email and more.Barcode GeneratorCreate Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG.UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Schema Markup Generator (JSON-LD)Create JSON-LD structured data for FAQ, Product, Article and more.Htaccess & Nginx Redirect GeneratorBuild 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects.Fake Data GeneratorGenerate mock data as JSON, CSV or SQL.Random String GeneratorGenerate secure random strings and tokens in bulk with any length and character set.API Key GeneratorCreate secure API keys and secrets with prefixes, checksums and SHA-256 hashes for storage.MIME Type LookupFind the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries.Cron Expression GeneratorBuild crontab schedules visually, read them in plain English and see the next run times.URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines.JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.Gitignore GeneratorBuild a .gitignore from 50+ templates for languages, frameworks, IDEs and OS, merged and deduped.License GeneratorCreate a LICENSE file for MIT, Apache, GPL, BSD, ISC, MPL or Unlicense with your name and year.ULID GeneratorGenerate sortable ULIDs and UUID v7 in bulk, monotonic option, and decode their timestamps.Htpasswd GeneratorCreate .htpasswd entries with bcrypt, APR1-MD5 or SHA-1 for Apache and Nginx basic auth.Placeholder Image GeneratorCreate placeholder images in any size, color and text as PNG, JPG, WebP, SVG or data URI.Ads.txt GeneratorCreate or validate ads.txt and app-ads.txt files: seller lines, cert IDs and variables.Dockerfile GeneratorGenerate a production Dockerfile and .dockerignore for Node, Python, Go or a static nginx site.HTML Boilerplate GeneratorTick the options you need and get a clean HTML5 starter template with meta, OG tags and CSS reset.JSON to Zod SchemaInfer a Zod (or Yup) schema from sample JSON with optional, nullable and z.infer types.Linux Commands Cheat SheetSearchable Linux and bash command reference with flags explained, examples and copy buttons.LLMs.txt GeneratorBuild an llms.txt file for AI crawlers: summary and link sections, import from your sitemap.Nano ID GeneratorGenerate secure Nano IDs with custom alphabet, length and count, plus a collision calculator.Nginx Config GeneratorBuild an nginx server block: static site, SPA, reverse proxy or PHP, with SSL, gzip and redirects.OpenAPI / Swagger ViewerView OpenAPI 2/3 JSON or YAML as interactive API docs with validation and an endpoint list.package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.PKCE Code Challenge GeneratorGenerate an OAuth 2.0 PKCE code_verifier and S256 code_challenge, build auth URLs, verify pairs.README GeneratorFill in a form and get a polished README.md with badges, install, usage and license, live preview.Regex GeneratorBuild regular expressions visually from blocks or presets (email, date, phone) and test them live.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Database Schema DesignerDesign tables and relationships visually, then export SQL for MySQL, PostgreSQL or SQLite.Dummy File GeneratorCreate test files of an exact size in KB, MB or GB with zeros, random bytes or text.FFmpeg Command GeneratorPick a task and options, get the exact ffmpeg command with every flag explained.Article Schema GeneratorCreate Article, BlogPosting or NewsArticle JSON-LD with headline, authors, dates and images.Event Schema GeneratorCreate Event JSON-LD with dates, venue or online location, tickets, organizer and performers.Google Search Query BuilderBuild advanced Google searches with site:, filetype:, intitle:, exact phrases and date operators.HowTo Schema GeneratorCreate HowTo JSON-LD with steps, tools, supplies, total time and cost, then copy it.Htaccess GeneratorBuild an Apache .htaccess file: HTTPS, www, gzip, caching, error pages, IP blocks, hotlinks.HTML Email Template BuilderDrag and drop blocks to build a responsive, table-based HTML email with inline styles.Organization Schema GeneratorCreate Organization JSON-LD with logo, URL, contact points, address and social profiles.PIN GeneratorGenerate random 4, 6 or 8-digit PINs that avoid sequences, repeats, dates and common PINs.Product Schema GeneratorBuild Product JSON-LD with price, availability, brand, GTIN, ratings and reviews.Question Keyword GeneratorFind the questions people ask about a topic, grouped by who, what, why, how, can and more.Recipe Schema GeneratorCreate Recipe JSON-LD with ingredients, steps, prep and cook times, nutrition and ratings.Security Headers GeneratorPick HSTS, CSP, frame, referrer and permissions options and get Apache, Nginx, Netlify or Cloudflare config.SKU GeneratorBuild consistent SKUs from brand, category, size and color, then export every variant as CSV.Typography Scale GeneratorBuild a modular type scale from a base size and ratio, then copy CSS variables or a Tailwind config.WordPress Salt GeneratorGenerate fresh WordPress security keys and salts for wp-config.php, .env or Docker in one click.ANSI Color Code GeneratorStyle terminal text with 16, 256 or RGB colors and get escape codes for bash, Python, JS and C.Apache Virtual Host GeneratorCreate an Apache VirtualHost config with SSL, redirects, reverse proxy or PHP-FPM in seconds.Bash Prompt GeneratorDrag and drop a custom PS1 prompt for bash or zsh with colors, git branch and a live preview.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.cURL Command BuilderBuild curl commands from a form: method, headers, query, JSON or form body, auth and flags.Docker Compose to KubernetesConvert docker-compose.yml into Kubernetes Deployment, Service, ConfigMap and PVC manifests.Dockerignore GeneratorBuild a .dockerignore from Node, Python, Go and Java templates, plus your own entries.ESLint Config GeneratorGenerate a flat eslint.config.js for JavaScript, TypeScript, React or Node with rule presets.Git Branch Name GeneratorTurn a ticket ID and title into a clean, valid git branch name like feature/PROJ-12-add-login.GitLab CI Config GeneratorGenerate a .gitlab-ci.yml with stages, jobs, images, cache, artifacts and rules from templates.Jinja2 Template TesterRender Jinja2 templates with YAML or JSON variables using real Jinja2, with clear error lines.JSON Schema Mock Data GeneratorGenerate realistic sample JSON from a JSON Schema: formats, patterns, $ref, seeds and counts.Kubernetes Secret GeneratorCreate Kubernetes Secret YAML from key/value pairs or .env with auto base64, or decode one.Kubernetes YAML ValidatorValidate Kubernetes manifests against the API schema of a chosen version, with error paths.Prettier Config GeneratorToggle Prettier options, preview formatted code live and copy your .prettierrc file.
    See all 85 Code Generators & Builders →