Skip to content

Remove ad-hoc docker-compose.yml validation #77

@mairas

Description

@mairas

Problem

The current docker-compose.yml validation in validator.py performs ad-hoc checks that can become out of sync with actual Docker Compose behavior. For example, we required the version field which is now obsolete in Docker Compose v2+.

Current validation

The validator checks:

  • version field exists and is >= 3.8 (now optional in Compose v2+)
  • services section exists
  • Other structural checks

Proposed solutions

  1. Minimal validation: Only validate that the file is valid YAML
  2. Use official schema: Use Docker Compose's JSON schema for validation
  3. Validate with target tool: Run docker compose config to validate using the actual tool

Recommendation

Option 3 (validate with target tool) would be most reliable as it ensures the compose file works with the actual Docker Compose version installed. However, it requires Docker to be available during validation.

Option 1 (minimal validation) is the simplest and avoids this class of bugs entirely - let Docker Compose report any errors at runtime.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions