{"record":{"id":"bb5307d3e747fe94","repo":"iflytek/astron-agent","slug":"docker-compose-is-unavailable","errorCode":null,"errorMessage":"Docker Compose is unavailable","messagePattern":"Docker Compose is unavailable","errorType":"console","errorClass":"GateError","httpStatus":null,"severity":"error","filePath":"docker/astronAgent/scripts/verify_security_contract.py","lineNumber":162,"sourceCode":"        commands.append((\"docker-compose\",))\n    return commands\n\n\ndef _select_compose_command(compose_file: Path) -> Sequence[str]:\n    for base_command in _compose_commands():\n        completed = subprocess.run(\n            list(base_command)\n            + [\"-f\", compose_file.name, \"config\", \"--format\", \"json\"],\n            cwd=str(compose_file.parent),\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            universal_newlines=True,\n            check=False,\n        )\n        if completed.returncode == 0:\n            return base_command\n    if not _compose_commands():\n        raise GateError(\"Docker Compose is unavailable\")\n    # Compose stderr can contain interpolated deployment data. Do not echo it.\n    raise GateError(\n        \"Docker Compose config failed; a Compose implementation supporting \"\n        \"'config --format json' is required\"\n    )\n\n\ndef _render_compose(compose_file: Path) -> Mapping[str, Any]:\n    base_command = _select_compose_command(compose_file)\n    completed = subprocess.run(\n        list(base_command) + [\"-f\", compose_file.name, \"config\", \"--format\", \"json\"],\n        cwd=str(compose_file.parent),\n        stdout=subprocess.PIPE,\n        stderr=subprocess.PIPE,\n        universal_newlines=True,\n        check=False,\n    )\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/docker/astronAgent/scripts/verify_security_contract.py#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install the Docker Compose plugin (e.g. apt-get install docker-compose-plugin or Docker Desktop) and verify with 'docker compose version'.","Ensure the docker/dockerd binary directory is on PATH for the user running the script.","If only the legacy docker-compose v1 binary is present, upgrade to a v2 implementation supporting 'config --format json'.","Run the script inside an image that includes docker compose (e.g. docker:24-cli with compose plugin)."],"exampleFix":"// before (CI job without compose)\npython scripts/verify_security_contract.py  # GateError: Docker Compose is unavailable\n// after\napt-get update && apt-get install -y docker-compose-plugin\npython scripts/verify_security_contract.py","handlingStrategy":"validation","validationCode":"import shutil\nassert shutil.which(\"docker\") or shutil.which(\"docker-compose\"), \"Docker Compose not on PATH\"","typeGuard":"def has_compose() -> bool:\n    import shutil\n    return bool(shutil.which(\"docker\") or shutil.which(\"docker-compose\"))","tryCatchPattern":null,"preventionTips":["Use CI images with docker-compose-plugin preinstalled.","Check 'docker compose version' as a preflight step in pipelines.","Keep PATH intact when invoking from cron/containers."],"tags":["docker","docker-compose","missing-dependency","ci"],"backgroundTag":"missing-dependency","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}