Docker Compose Validator
Validate Docker Compose YAML files online for syntax errors, structure issues, and best practices. Get detailed error messages with line numbers instantly.
What does Docker Compose validation check?
It validates YAML syntax, checks for required fields like services, verifies each service has image or build, validates port and volume formats, and checks depends_on references.
What Docker Compose versions are supported?
The validator supports both the legacy version field (e.g. version: "3.8") and the modern format without a version field, following the latest Docker Compose specification.
Is my Docker Compose file sent to a server?
No. All validation happens locally in your browser. No data is uploaded to any server.
What are common Docker Compose mistakes?
Common issues include missing image or build in services, invalid port formats, undefined volume references, incorrect depends_on targets, and deprecated version fields.
How do I fix "service has neither image nor build" error?
Each service in Docker Compose must specify either an image to pull from a registry or a build context to build locally. Add either "image: nginx:latest" or "build: ." to your service definition.
What is the correct port format in Docker Compose?
Ports can be specified as strings "8080:80" or numbers. The format is "host_port:container_port". You can also specify the protocol: "8080:80/tcp". Avoid using bare numbers without quotes for port ranges.
How do I validate environment variables in Docker Compose?
Environment variables can be defined as a list (KEY=value) or as a mapping. The validator checks for proper formatting and warns about missing values. You can also use .env files for variable substitution.
Can I check Docker Compose files before deployment?
Yes, validating your Docker Compose file before running docker-compose up is a best practice. It catches syntax errors, missing dependencies, and configuration issues early, saving debugging time.
What are Docker Compose best practices?
Use specific image tags instead of latest, define healthchecks for services, use named volumes for persistent data, create custom networks for service isolation, and use .env files for configuration management.
How does the validator handle multi-document YAML?
Docker Compose files should contain a single document. If your file has multiple YAML documents separated by ---, the validator will process the first document and warn about additional content.
What network configurations are validated?
The validator checks network definitions, verifies services reference defined networks, validates network driver options, and checks for proper bridge, overlay, or external network configurations.
Can I use this validator in CI/CD pipelines?
Yes, the validator works offline in your browser, making it perfect for local testing before committing. For CI/CD integration, consider using the official docker-compose config command or dedicated CLI tools.
How do I validate Docker Compose secrets and configs?
Secrets and configs must be defined at the top level and referenced by services. The validator checks that referenced secrets/configs exist in the top-level definitions and that file or external sources are properly specified.
What volume types are supported?
The validator supports named volumes, bind mounts, tmpfs mounts, and volume options. It checks that named volumes are defined in the top-level volumes section and that bind mount paths are properly formatted.