Files
Docker-Swarm-Services/.claude/skills/docker-swarm-stack.md

1.3 KiB

Docker Swarm Stack Skill

Use this skill when adding, reviewing, or modifying Docker Swarm stack files in this repository.

Workflow

  1. Confirm the service belongs in the Swarm repo.
  2. Create or update a Swarm-compatible stack YAML file.
  3. Create or update .env.example with placeholders only.
  4. Use Docker secrets/configs for sensitive runtime values.
  5. Define overlay networks and named volumes explicitly.
  6. Add deploy: settings only when they are meaningful.
  7. Validate YAML/Compose rendering where possible.
  8. Explain deployment commands, required secrets, required networks, and rollback notes.

Swarm Standards

  • Use 2-space YAML indentation.
  • Prefer explicit image tags over unpinned latest when stability matters.
  • Use deploy.restart_policy for Swarm-managed services.
  • Use placement.constraints when a service must run on a specific node or node label.
  • Do not use container_name; it is ignored or problematic in Swarm.
  • Be careful with depends_on; Swarm does not honor Compose startup ordering the same way local Compose does.
  • Prefer external secrets for sensitive values.

Validation Command Pattern

docker compose --env-file <service>.env.example -f <stack-file>.yml config

Do not run docker stack deploy unless explicitly asked.