iflytek/astron-agent · error · GateError

Docker Compose is unavailable

Error message

Docker Compose is unavailable

What it means

verify_security_contract.py raises GateError('Docker Compose is unavailable') from _select_compose_command when no Compose implementation can be found on PATH. The helper iterates candidate commands (docker compose, docker-compose) and probes each with 'config --format json'; if none exists at all, it concludes Compose is not installed. It is a hard prerequisite gate: the security contract check cannot render the compose file without it.

Solutions

  1. Install the Docker Compose plugin (e.g. apt-get install docker-compose-plugin or Docker Desktop) and verify with 'docker compose version'.
  2. Ensure the docker/dockerd binary directory is on PATH for the user running the script.
  3. If only the legacy docker-compose v1 binary is present, upgrade to a v2 implementation supporting 'config --format json'.
  4. Run the script inside an image that includes docker compose (e.g. docker:24-cli with compose plugin).

Example fix

// before (CI job without compose)
python scripts/verify_security_contract.py  # GateError: Docker Compose is unavailable
// after
apt-get update && apt-get install -y docker-compose-plugin
python scripts/verify_security_contract.py
Defensive patterns

Strategy: validation

Validate before calling

import shutil
assert shutil.which("docker") or shutil.which("docker-compose"), "Docker Compose not on PATH"

Type guard

def has_compose() -> bool:
    import shutil
    return bool(shutil.which("docker") or shutil.which("docker-compose"))

Prevention

When it happens

Trigger: Running the verify_security_contract script when neither 'docker compose' nor 'docker-compose' resolves to a working binary; _compose_commands() returns empty because no candidate was found on PATH.

Common situations: Docker not installed in CI runner images; running the script on a host without Docker Desktop; Compose plugin missing (docker-compose-plugin package absent); PATH stripped in cron/container contexts so docker is invisible.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/bb5307d3e747fe94. Report an issue: GitHub.

Appendix: source

Thrown at docker/astronAgent/scripts/verify_security_contract.py:162

        commands.append(("docker-compose",))
    return commands


def _select_compose_command(compose_file: Path) -> Sequence[str]:
    for base_command in _compose_commands():
        completed = subprocess.run(
            list(base_command)
            + ["-f", compose_file.name, "config", "--format", "json"],
            cwd=str(compose_file.parent),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True,
            check=False,
        )
        if completed.returncode == 0:
            return base_command
    if not _compose_commands():
        raise GateError("Docker Compose is unavailable")
    # Compose stderr can contain interpolated deployment data. Do not echo it.
    raise GateError(
        "Docker Compose config failed; a Compose implementation supporting "
        "'config --format json' is required"
    )


def _render_compose(compose_file: Path) -> Mapping[str, Any]:
    base_command = _select_compose_command(compose_file)
    completed = subprocess.run(
        list(base_command) + ["-f", compose_file.name, "config", "--format", "json"],
        cwd=str(compose_file.parent),
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        universal_newlines=True,
        check=False,
    )

View on GitHub (pinned to 5e758547a8)