Official agent skill

Docker Compose Patterns

by docker in docker/skills

A skill your agent uses when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up…

OfficialApache-2.0Auto-check: notesDevOps & Cloud

Install Docker Compose Patterns

skills CLI
$ npx skills add docker/skills --skill docker-compose-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install docker/skills docker-compose-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/docker/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/docker-compose-patterns .claude/skills/docker-compose-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
docker-compose-patterns
GitHub stars
539
Token cost
~2.4k tokens
SKILL.md length
1,103 words
Files
10 (incl. scripts, references, assets)
Skills in repo
11
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up…

  • Debugging Docker Compose configurations
  • SKILL.md covers Overview, When to use this skill, Do not use this skill when and Core guidance, plus 5 more sections
  • Runs Shell scripts from its folder; calls docker, bash and redis-cli; needs DB_PASSWORD
  • Even if the user just says they need to wire services together

What it does

Docker Compose Patterns is an agent skill from docker/skills, published by the product's own GitHub organization. Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 14 other files, including scripts, reference files and assets (for example `agents/openai.yaml`, `assets/bad-vs-good.md` and `assets/compose-dev-override.yaml`). Compatibility notes: Requires Docker Compose v2 (compose.yaml format).

It sits in DevOps & Cloud, covering Containers and gRPC and Protobuf. It works with Docker. The repository describes itself as: A collection of Docker skills for AI coding agents to help them build, test, debug, and optimize containerized apps with consistent, reusable workflows. The licence is Apache-2.0.

When your agent uses it

  • Debugging Docker Compose configurations
  • Even if the user just says they need to wire services together
  • Add a database to their stack
  • Set up a local development environment with multiple containers

Example prompts

  • “/docker-compose-patterns”

Requirements

  • A Bash shell
  • Docker
  • Compatibility (from SKILL.md): Requires Docker Compose v2 (compose.yaml format).

What it can do on your machine

Read from SKILL.md and the folder at commit f791727. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • docker
    • bash
    • redis-cli

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use docker, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • DB_PASSWORD

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires Docker Compose v2 (compose.yaml format).

    From compatibility in the SKILL.md frontmatter.

Context cost

Docker Compose Patterns loads about 2.4k tokens when it runs, and up to ~4k if it reads all its reference files. Until then it costs about 101 tokens; SKILL.md has 1,103 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~101
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:115
    - Use `env_file:` pointing to a `.env` file for longer lists of variables.
  • NoteMentions a .env fileSKILL.md:118
    - Add `.env` to `.gitignore`.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from docker/skills at commit f791727, republished under its Apache-2.0 licence (© docker). 1,103 words, ~2,426 tokens.

Download SKILL.mdSave it as .claude/skills/docker-compose-patterns/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
docker-compose-patterns
description
Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.
compatibility
Requires Docker Compose v2 (compose.yaml format).
license
Apache-2.0

Docker Compose Patterns

Overview

This skill provides rules for creating, reviewing, and debugging Docker Compose configurations. Use it when the main artifact is compose.yaml or compose.override.yaml and the task is about service wiring rather than image-build internals.

When to use this skill

Activate this skill when:

  • Creating a new compose.yaml for a project
  • Adding or modifying services in an existing Compose file
  • Setting up development overrides with compose.override.yaml
  • Debugging service startup ordering or connectivity issues

Do not use this skill when

Do not use this skill when:

  • The project has no Docker setup yet and the main need is an initial scaffold
  • The main task is writing or optimizing a Dockerfile
  • The main task is improving build caching, image size, or runtime user configuration

Core guidance

File naming

Use compose.yaml as the canonical filename. Do not use docker-compose.yml or docker-compose.yaml — those are legacy names.

Service definitions
  • Give services clear, lowercase names that reflect their role: web, db, cache, worker.
  • Always pin image tags to a specific version. Never use latest or omit the tag.
  • Set restart: unless-stopped for long-running infrastructure services and non-development deployments.
  • Add container_name only when external tools need a predictable name. Otherwise, let Compose generate names.
Dependency modeling
  • Use depends_on with condition: service_healthy for services that must be ready before dependents start.
  • Every service listed in depends_on with a health condition must have a healthcheck defined.
  • Do not rely on depends_on without conditions — it only guarantees container start, not readiness.
Health checks
  • Always add a healthcheck to database services (Postgres, MySQL, Redis, MongoDB).
  • Use the service's native client tool for health checks when available (e.g., pg_isready, redis-cli ping, mysqladmin ping).
  • Set reasonable interval, timeout, retries, and start_period values. Start with: interval: 5s, timeout: 3s, retries: 3, start_period: 10s.
Health checks for distroless or scratch images

Distroless, scratch-based, and hardened images contain no shell, curl, or wget. Do not bake tools into these images — that defeats their purpose. Instead, use a healthcheck sidecar that shares the application's network namespace:

yaml
services:
  api:
    build:
      context: .
      target: runtime          # distroless / hardened image
    ports:
      - "8080:8080"
    # No healthcheck here — the image has no tools to run one

  api-health:
    image: curlimages/curl:8.22.0
    network_mode: "service:api"   # shares api's localhost
    entrypoint: ["sleep", "infinity"]  # keep sidecar alive for healthcheck
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 45s
    deploy:
      resources:
        limits:
          memory: 32M

Key points:

  • The sidecar must stay alive with entrypoint: ["sleep", "infinity"] so Compose can execute the healthcheck inside it.
  • network_mode: "service:api" makes localhost inside the sidecar resolve to the api container's loopback — no extra networking needed.
  • Keep the sidecar lightweight with a resource limit (32MB is sufficient for curl).
  • Services that depend on api being ready should reference the sidecar, not the api directly:
yaml
  worker:
    depends_on:
      api-health:
        condition: service_healthy
Volumes
  • Use named volumes for data that must persist across container recreations (database data, uploaded files).
  • Use bind mounts only for development-time source code syncing.
  • Define all named volumes in the top-level volumes: key.
  • Do not mount the Docker socket unless the service genuinely requires it.
Networks
  • For single-application stacks, the default network is sufficient. Do not create custom networks unless you need isolation between service groups.
  • When creating custom networks, prefer bridge driver and give networks descriptive names.
  • Use the top-level networks: key to define all custom networks.
Environment variables
  • Use environment: for non-sensitive values that are few in number.
  • Use env_file: pointing to a .env file for longer lists of variables.
  • Never hardcode secrets (passwords, API keys) directly in compose.yaml. Use env_file: or Docker secrets.
  • When defaults are needed in the environment: block for local development, use variable substitution with fallbacks: ${DB_PASSWORD:-postgres}. Never write bare plaintext values for password fields.
  • Add .env to .gitignore.
Development overrides
  • Use compose.override.yaml for development-only settings. Compose loads it automatically alongside compose.yaml.
  • Put bind mounts for source code, debug ports, and development environment variables in the override file.
  • Use develop.watch for file-syncing and auto-rebuild in development when supported.
  • Keep production-oriented settings in the base compose.yaml and override only what changes for development.
Compose Watch
  • Prefer develop.watch over manual bind mounts for development workflows.
  • Use action: sync for files that should be copied into the container on change (source code).
  • Use action: rebuild for files that require a full image rebuild (dependency files like package.json, requirements.txt).
  • Use action: sync+restart for configuration files that need a process restart.
Show full SKILL.md (449 more words)Show less
Destructive commands

Some Compose commands delete data irreversibly. Before running any of the following, state exactly which data will be deleted and get explicit confirmation from the user — do not run them as a side effect of debugging, restarting, or "cleaning up" a stack:

  • docker compose down -v / docker compose down --volumes — deletes named volumes, including database data.
  • docker volume rm / docker volume prune run against a Compose project's volumes — deletes volumes directly. For the standalone case (no Compose project in play), see docker-destructive-guardrails instead. A volume referenced via external: true isn't managed by the Compose project either (down -v won't touch it) — treat it as the standalone case too: run docker volume rm without -f first, and get explicit confirmation before deleting it.
  • docker compose rm -v — deletes anonymous volumes attached to removed containers.

If the goal is only to restart services or reclaim containers/networks, use docker compose down (no -v) or docker compose restart instead — these leave named volumes intact.

  • For first-time Docker project scaffolding and baseline file creation, use docker-project-foundations.
  • For Dockerfile internals, build caching, multi-stage builds, and .dockerignore, use docker-build-strategies.
  • For destructive Docker CLI commands outside Compose (docker system prune, docker rm -f, image/network/builder pruning, standalone volume deletion) and a cross-product index of destructive-command guardrails, use docker-destructive-guardrails.

References

  • references/service-dependencies.md — Detailed guidance on depends_on, health check patterns for common databases, and startup ordering strategies.
  • references/volumes-and-networks.md — Patterns for volume mounts, named volumes, bind mounts, and network configuration.

Assets

  • assets/compose-web-app.yaml — Complete multi-service web app (app + Postgres + Redis) with health checks, dependencies, and named volumes.
  • assets/compose-dev-override.yaml — Development override showing bind mounts, debug ports, and Compose Watch configuration.
  • assets/bad-vs-good.md — Before/after comparisons of common Compose mistakes and their fixes.

Scripts

  • scripts/verify-compose.sh — Validates the Compose project in the current directory with docker compose config --quiet, without printing resolved configuration. Run it from the project root (the directory that contains compose.yaml), with the script path resolved under this skill's directory:
    bash
    bash "<skill-dir>/scripts/verify-compose.sh" [--help]
    Replace <skill-dir> with the absolute path of the folder that contains this SKILL.md; the scripts/ path is relative to that folder, not to the project. Do not change into the skill directory first: the script validates whatever Compose project is in the current directory. If the skill directory cannot be resolved, run docker compose config --quiet directly. Exit status is 0 when the Compose configuration is valid or help is requested, the non-zero status from docker compose config --quiet when validation fails, and 2 for invalid arguments. Plain docker compose config can expose interpolated and env_file credentials in tool output or logs; use quiet validation by default. Compose warnings and errors are still emitted and may contain sensitive details.

Checks

  • checks/verification.md — Detailed verification runbook for manual review.

© docker, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 9 other files (scripts, references, assets) in skills/docker-compose-patterns of docker/skills.

  • SKILL.md
  • agents/openai.yaml
  • assets/bad-vs-good.md
  • assets/compose-dev-override.yaml
  • assets/compose-web-app.yaml
  • checks/verification.md
  • references/service-dependencies.md
  • references/volumes-and-networks.md
  • scripts/verify-compose.sh
  • skill.yaml

Open the folder on GitHubat commit f791727

Compare with similar skills

Docker Compose Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Docker Compose Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Docker Compose Patterns this skilldocker/skills539—~2.4kAutomated safety check: NotesApache-2.0
Setup Cpu Proxy Serverdrawthingsai/draw-things-community579—~3.8kAutomated safety check: PassGPL-3.0
Iron Proxy Gateway for NanoClawnanocoai/nanoclaw31k—~4.6kAutomated safety check: NotesMIT
GreptimeDB Dev Docker ImageGreptimeTeam/greptimedb6.7k—~4kAutomated safety check: NotesApache-2.0
Senior DevOps Toolkitmaslennikov-ig/claude-code-orchestrator-kit2596 repos~1.1kAutomated safety check: NotesCustom licence
LangBot Deployment Guidelangbot-app/LangBot18k—~1.2kAutomated safety check: NotesApache-2.0

Similar skills

  • Setup Cpu Proxy Server

    drawthingsai/draw-things-community

    Set up and verify a new Draw Things CPU proxy and Envoy server using the scripts in Scripts/ServerManagement/CPUScript.

    579 GitHub stars~3.8k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Installs or refreshes Iron Proxy and its Iron Control web console for NanoClaw, with a local Docker setup, database, credentials and a human approval bridge.

    31k GitHub stars~4.6k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes
  • GreptimeDB Dev Docker Image

    GreptimeTeam/greptimedb

    Packages a locally built GreptimeDB debug binary into a development-only Docker image for local-cluster testing, with an optional push to a dev registry.

    6.7k GitHub stars~4k tokensUpdated 2 days ago
    DevOps & CloudAuto-check: notes
  • Senior DevOps Toolkit

    maslennikov-ig/claude-code-orchestrator-kit

    Comprehensive DevOps skill for CI/CD, infrastructure automation, containerization, and cloud platforms (AWS, GCP, Azure). Includes pipeline setup…

    259 GitHub starsUsed in 6 repos~1.1k tokens
    DevOps & CloudAuto-check: notes
  • LangBot Deployment Guide

    langbot-app/LangBot

    Deploys and configures a LangBot instance with Docker Compose or Kubernetes, covering config.yaml, the Box sandbox runtime, the plugin runtime and the global API key.

    18k GitHub stars~1.2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Official

    Maintain and validate OpenShell's build-only Windows MSVC lane for x64 and ARM64.

    15k GitHub stars~4.9k tokensUpdated today
    DevOps & CloudAuto-check passed

More from docker/skills

All 11 skills in this repo
  • Official

    A skill your agent uses when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production.

    539 GitHub stars~3k tokensUpdated 3 days ago
    Auto-check: warnings
  • Docker Agent Config

    docker/skills

    Official

    A skill your agent uses when creating or editing an agent.yaml (or .yml/.hcl) configuration file for Docker Agent (cagent), including defining agents, models/providers, built-in or MCP toolsets…

    539 GitHub stars~2.5k tokensUpdated 3 days ago
    Auto-check: notes
  • Docker Agent Deploy

    docker/skills

    Official

    A skill your agent uses when exposing a Docker Agent as a server (MCP, HTTP API, A2A, ACP, or OpenAI-compatible chat), distributing an agent via an OCI registry with docker agent share, or measuring…

    539 GitHub stars~1.9k tokensUpdated 3 days ago
    Auto-check passed
  • Official

    A skill your agent uses when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a…

    539 GitHub stars~1.9k tokensUpdated 3 days ago
    Auto-check: warnings
  • Official

    A skill your agent uses when authoring, planning, or running a declarative sbxenv.yaml file for Docker Sandboxes (sbx env create/run/plan/exec/rm), even if the user just says they want to "check in…

    539 GitHub stars~4k tokensUpdated 3 days ago
    Auto-check passed
  • Official

    A skill your agent uses when authoring, validating, packaging, signing, or composing a Docker Sandboxes kit spec.yaml (sbx kit add/inspect/pack/pull/push/sign/validate/verify), even if the user just…

    539 GitHub stars~4.2k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Docker Compose Patterns

What does Docker Compose Patterns do?

A skill your agent uses when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up…. Docker Compose Patterns is an agent skill from docker/skills, published by the product's own GitHub organization. Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers.

When should I use Docker Compose Patterns?

Docker Compose Patterns fits situations like: debugging Docker Compose configurations; even if the user just says they need to wire services together; add a database to their stack; set up a local development environment with multiple containers.

How do I install Docker Compose Patterns in Claude Code?

Run `npx skills add docker/skills --skill docker-compose-patterns -a claude-code`. Or copy the skill folder (skills/docker-compose-patterns in docker/skills) into .claude/skills/docker-compose-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Docker Compose Patterns in Codex?

Run `npx skills add docker/skills --skill docker-compose-patterns -a codex`. Or copy the skill folder (skills/docker-compose-patterns in docker/skills) into .agents/skills/docker-compose-patterns in your project. Codex loads it when a task matches its description.

Can I use Docker Compose Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add docker/skills --skill docker-compose-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/docker-compose-patterns, .gemini/skills/docker-compose-patterns, .github/skills/docker-compose-patterns and .opencode/skills/docker-compose-patterns in your project.

What does Docker Compose Patterns need to run?

Going by SKILL.md and its folder, Docker Compose Patterns needs a shell for the scripts in its folder, the command-line tools its instructions call (docker, bash and redis-cli) and credentials named DB_PASSWORD. Our summary lists: A Bash shell; Docker. Compatibility (from SKILL.md): Requires Docker Compose v2 (compose.yaml format)..

Does Docker Compose Patterns access the network?

SKILL.md contains no URLs. Its commands use docker, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Docker Compose Patterns safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Docker Compose Patterns use?

Docker Compose Patterns is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Docker Compose Patterns use?

About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.6k tokens, read only when the agent opens those files.

What are the alternatives to Docker Compose Patterns?

Skills that share tags, products or a category with Docker Compose Patterns: Setup Cpu Proxy Server (drawthingsai/draw-things-community, 579 stars), Iron Proxy Gateway for NanoClaw (nanocoai/nanoclaw, 31k stars), GreptimeDB Dev Docker Image (GreptimeTeam/greptimedb, 6.7k stars) and Senior DevOps Toolkit (maslennikov-ig/claude-code-orchestrator-kit, 259 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Docker Compose Patterns?

docker (a GitHub organization, an official publisher) maintains it in docker/skills, which has 539 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 4, 2026.

Source: docker/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.