---
name: "docker-compose-production-spec"
description: "Orchestrate multi-container application stacks with production compose specifications."
metadata:
  author: "Docker"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "write docker-compose healthcheck"
  - "set docker compose resource limits"
  - "docker compose profiles"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Docker Compose Production Profiles & Healthchecks

Configures Docker Compose v2: defining services, healthcheck intervals, restart policies, internal bridge networks, named volume persistence, environment variables (.env), and deploy resource limits (cpus, memory).

## When to Invoke
Invoke this skill whenever you need to:
- write docker-compose healthcheck
- set docker compose resource limits
- docker compose profiles

## Execution SOP & Rules
1. Define healthcheck on database services (pg_isready -U postgres) with interval 10s and retries 5.
2. Use condition: service_healthy in depends_on blocks for deterministic startup ordering.
3. Assign deploy.resources.limits (e.g. cpus: '2.0', memory: 2048M) to prevent resource starvation.
4. Test compose file validity with docker compose config and test teardown with docker compose down -v.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
