Docker Compose Operator Skill
Stateless atomic operation to compile template compose definitions, resolve active environment parameter overlays, deploy/restart Docker containers or Swarm stacks safely, and monitor container execution logs to verify operational health.
Prerequisites
container-manager-mcp— for initiating compose actions (up,down,ps,logs), deploying service stacks, and monitoring process readiness.
Steps
Step 1: compile_compose_manifest
Assemble the targeted deployment specifications and validate syntax and overrides:
- Locate the reference compose YAML file (e.g.
docker-compose.ymlorstack.yml) and its corresponding.envor configuration parameters. - Substitute template variables, environment configuration keys, and host path references.
- Execute validation on the compiled compose syntax (e.g. verify YAML validity, check that image references are fully qualified, and check that required volume mounts exist on the host).
- Output parameters:
manifest_valid: Boolean indicating successful compilation.resolved_manifest_path: Absolute path to the validated temporary compose file.
Step 2: execute_compose_deployment [depends_on: compile_compose_manifest]
Execute deployment operations with safety checks:
- Trigger container launch:
- Invoke
upor stackdeployoperations viacontainer-manager-mcp(e.g., usingcm_compose_operations). - Pass the compiled configuration file and specify proper namespace/stack definitions.
- Invoke
- Coordinate dependencies and rolling replacements:
- Verify if pre-requisite backing databases or network subnets are operational before launching core app containers.
- Enforce graceful termination timeouts for old container replicas to prevent socket drops.
- Output parameters:
deployment_exit_code: Int process return code.deployment_raw_output: String command outputs.
Step 3: verify_operational_health [depends_on: execute_compose_deployment]
Perform granular verification of the active containers to ensure readiness and stability:
- Poll container states:
- Wait for containers to exit boot phases, querying runtime statuses (
running,healthy,restarting).
- Wait for containers to exit boot phases, querying runtime statuses (
- Log inspection and error parsing:
- Retrieve and parse container stdout/stderr logs (e.g. using
get_container_logsaction). - Scan for common startup exceptions (e.g.,
ConnectionRefusedError,Database error,Exception).
- Retrieve and parse container stdout/stderr logs (e.g. using
- readiness probes:
- If web ports or health check endpoints are mapped, test their accessibility (expecting standard
200 OKor valid TCP socket connections).
- If web ports or health check endpoints are mapped, test their accessibility (expecting standard
- Output parameters:
status: "SUCCESS" or "FAILED"active_containers: List of running service instances with their states.health_log_summary: Summary of any anomalies or startup errors discovered.