Docker patterns for Dockerfiles, multi-stage builds, Compose, networking, and volumes. Load before any edit to a Dockerfile, Compose file, or .dockerignore, however small, and for container questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Docker Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-docker-patterns)
---
name: docker-patterns
description: Docker patterns for Dockerfiles, multi-stage builds, Compose, networking, and volumes. Load before any edit to a Dockerfile, Compose file, or .dockerignore, however small, and for container questions.
---
# Docker patterns
Default assumption: Docker Engine 29.10.1, Dockerfile frontend 1.29, and Compose 5.8, per the Docker Engine release notes and the BuildKit and Compose releases.
An Engine row applies when the daemon is at least its version, a Dockerfile row when the `# syntax=docker/dockerfile:<version>` line or the builder's bundled frontend is, and a Compose row when `docker compose version` is.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing a Dockerfile, or upgrading Docker Engine, Buildx, or Compose | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing a Dockerfile, `.dockerignore`, or `docker run` | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Choosing a base image, splitting stages, ordering instructions, installing packages with `apt-get`, setting `ENTRYPOINT` or `CMD`, adding a user, or a `.dockerignore` | [reference/practices.md](reference/practices.md) |
| Writing or changing a Compose file | [reference/compose.md](reference/compose.md) |
| Configuring build checks, hadolint, dclint, Trivy, or Docker Scout | [reference/tooling.md](reference/tooling.md) |