docker

Guide Dockerfile creation with multi-stage builds and security hardening.

3|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/deandum/claude-resources --skill docker-deandum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker
Source: https://github.com/deandum/claude-resources/tree/main/skills/core/docker
Command: npx skills add https://github.com/deandum/claude-resources --skill docker-deandum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Containerization principles — multi-stage builds, base image selection, layer caching, security. Use when containerizing a service, shrinking a bloated image, chasing CVEs in a base image, adding non-root + distroless to an existing Dockerfile, or reviewing any Dockerfile / .dockerignore changes. Trigger on any task mentioning "docker", "container", "image", "base image", or "deploy to kubernetes" — even when the user does not explicitly say "use the docker skill". Pair with language-specific docker skill for build patterns.

Core Features & Use Cases

  • Multi-stage builds to create small, production-ready runtime images.
  • Secure defaults: non-root user, pinned base images, and avoidance of secrets in layers.
  • Caching strategies and .dockerignore hygiene to speed up builds and reduce context size.

Quick Start

Choose a base image and craft a two-stage Docker build to produce a small, secure, production-ready container.

Frequently Asked Questions about docker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build small, secure Docker containers for production?

To build small, secure Docker containers, use multi-stage builds to isolate build dependencies from runtime images, pin base images, configure a non-root user, and apply .dockerignore hygiene to reduce context size.

What is a multi-stage Docker build and when should I use it?

A multi-stage Docker build uses multiple FROM statements to copy only compiled artifacts into a final distroless or minimal image, shrinking image size and eliminating build toolchain vulnerabilities for production deployments.

How do I fix CVEs and security vulnerabilities in my Docker base image?

Fix CVEs in your Docker base image by pinning to specific immutable image versions, switching to distroless runtime bases, and ensuring a non-root runtime user to harden container security against exploits.

How do I speed up Docker image builds using layer caching?

Speed up Docker image builds by optimizing layer caching strategies, ordering Dockerfile instructions from least to most frequently changing, and using .dockerignore to exclude unnecessary files from the build context.

Does this containerization guidance work for deploying services to Kubernetes?

Yes, this containerization guidance applies directly to deploying services to Kubernetes by ensuring production-ready Docker images are small, secure, and built with efficient layer caching for CI/CD pipelines.

What is the best way to prevent secrets from leaking into Docker image layers?

The best way to prevent secrets in Docker image layers is to avoid baking them into the Dockerfile, use multi-stage builds to drop sensitive build arguments, and rely on runtime injection for production environments.