Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

docker-build-strategies

Skill by docker

Writes, reviews, and optimizes Dockerfiles for production-quality container images. Covers multi-stage builds, layer caching, .dockerignore, non-root users, build secrets, and image size. Aimed at developers who need smaller or hardened images.

  • Score 88
  • 668 stars
  • Apache-2.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install docker-build-strategies

Built from the published package, never by AI.

git clone --depth 1 https://github.com/docker/skills /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/skills/docker-build-strategies ~/.claude/skills/docker-build-strategies

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install docker-build-strategies in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

Docker Build Strategies is an agent skill with rules and patterns for writing, reviewing, and optimizing Dockerfiles. It covers multi-stage builds, layer caching with BuildKit cache mounts, .dockerignore files, non-root users, and image size reduction. It also gives guidance on build secrets and SSH mounts so credentials do not persist in image layers.

The skill is meant for developers who need production-quality container images. It includes reference patterns for Go, Node.js, Python, and Java, plus Dockerfile and .dockerignore templates. A verify-build script reports image size and the configured user. The skill says to use other skills for first-time project scaffolding, Compose wiring, and destructive Docker commands.

Written from the project's SKILL.md and checked against it.

What it can do

  • Multi-stage buildsSeparates build-time dependencies from the runtime image using named stages and COPY --from.
  • Layer cachingOrders instructions by change frequency and uses BuildKit cache mounts for package managers.
  • Build secrets and SSHUses RUN --mount=type=secret and type=ssh so credentials stay out of image layers.
  • .dockerignore guidanceGenerates a .dockerignore file that excludes git data, dependencies, docs, and secrets.
  • Non-root user setupCreates a dedicated user in the runtime stage and sets USER before ENTRYPOINT or CMD.
  • Image size optimizationRecommends scratch, distroless, or Alpine runtime bases and avoids installing debug tools.
  • Build verification scriptRuns verify-build.sh to build the Dockerfile and report image size and configured user.

What you need

  • Docker 23.0 or later, or Docker 20.10 to 22.x with DOCKER_BUILDKIT=1 set

Try asking

  • Review my Dockerfile and make the runtime image smaller.
  • Add a .dockerignore file to this project and explain each exclusion.
  • Convert this Dockerfile to run as a non-root user with cache mounts.

Good to know

  • Not for first-pass scaffolding of projects with no Docker setup.
  • Not for Compose services, networking, or development overrides.
  • The verify-build script is missing in some distributions, so a manual docker build is needed.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: skills/docker-build-strategies/SKILL.md, skills/docker-build-strategies/scripts/verify-build.sh. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md12 KB
  • agents/openai.yaml256 B
  • assets/Dockerfile.go821 B
  • assets/Dockerfile.nodejs2 KB
  • assets/Dockerfile.python1 KB
Show all 12 files
  • assets/dockerignore-example644 B
  • checks/verification.md6 KB
  • evals/docker-build-strategies.md10 KB
  • references/layer-caching.md6 KB
  • references/multi-stage-builds.md9 KB
  • scripts/verify-build.sh903 B
  • skill.yaml773 B

Alternatives to docker-build-strategies

All alternatives →
deploy-release-testvercel
94

Runs the full Next.js deployment test suite for an internal vercel/next.js pull request. It validates the commit's preview package, then dispatches the test_e2e_deploy_release.yml workflow. Meant for maintainers who explicitly ask for the entire suite.

AAA Skill 144k
deepeval-tracingconfident-ai
94

Instruments Python AI applications with DeepEval's native tracing so their execution appears span by span in Confident AI's Observatory. It is for developers building LLM apps, agents, RAG pipelines and chatbots.

AAA Skill 20k
azure-container-registry-cligithub
94

Manages Azure Container Registry through the az acr Azure CLI command group. It covers registries, images, cloud builds, ACR Tasks, tokens, geo-replication and networking. Built for developers and operators who work with ACR in Azure.

AAA Skill 42k
crabbox-appsopenclaw
94

Opens, runs, and shows apps on a temporary Crabbox machine, including native desktops and web previews. It is for OpenClaw users who want an app running and visible in their chat side panel.

AAA Skill 395k
gke-batch-hpcgoogle
94

Runs batch and HPC workloads on GKE using job queues and parallel processing. Aimed at teams running batch pipelines, HPC simulations, or ML training jobs on Google Kubernetes Engine.

AAA Skill 25k
gke-cost-analysisgoogle
94

Answers questions about GKE cluster and workload costs using BigQuery billing exports and live cluster metrics. Built for platform engineers and cloud teams who need to analyze and diagnose GKE spend.

AAA Skill 25k

Compare with deploy-release-test, deepeval-tracing or azure-container-registry-cli

docker-build-strategies: common questions

Does this skill work with Docker Compose?

The skill says wiring services in compose.yaml and Compose startup debugging are out of scope. It points to a separate docker-compose-patterns skill for those tasks.

How does it handle private package credentials?

It says never to pass credentials through ARG or ENV or copy credential files into the build context. It recommends RUN --mount=type=secret and type=ssh instead.

Which Docker version is required?

The source says Docker 23.0 or later is required because BuildKit is the default. On Docker 20.10 to 22.x, set DOCKER_BUILDKIT=1 before building.

How do I install docker-build-strategies?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is docker-build-strategies free?

The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.

Is docker-build-strategies safe to use?

It scores 88 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to docker-build-strategies?

Similar skills: deploy-release-test, deepeval-tracing, azure-container-registry-cli, crabbox-apps.

docker-build-strategies Install

Add to stack

Loading.