No slash command · from container-plugin
Guides writing and hardening Dockerfiles with multi-stage builds, non-root users, slim images, and CVE/Trivy remediation. Use when authoring or patching a Dockerfile, docker-compose, or addressing a container scan finding.
Ships in container-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Expert knowledge for containerization and orchestration with focus on security-first, lean container images and 12-factor app methodology.
| Use this skill when... | Use a language-specific sibling (go-containers, nodejs-containers, python-containers) instead when... |
|---|---|
| Writing or optimizing language-agnostic Dockerfiles | Optimizing Go static binaries, Node.js Alpine builds, or Python slim images |
| Authoring multi-stage build patterns or 12-factor configuration | The image-size goal is dominated by language runtime choices (scratch, distroless, musl/glibc) |
| Hardening containers (non-root, minimal base, secrets) | Running Skaffold sync (skaffold-filesync) or OrbStack networking (skaffold-orbstack) |
| Composing services with Docker Compose | The work is purely a Skaffold pre-deploy test (skaffold-testing) |
| Fixing a CVE or Trivy finding, or a stale CA bundle, in an existing Dockerfile | — |
Non-Root is MANDATORY: ALL production containers MUST run as non-root users. This is not optional.
Minimal Base Images: Use Alpine (~5MB) for Node.js/Go/Rust. Use slim (~50MB) for Python (musl compatibility issues with Alpine).
Multi-Stage Builds Required: Separate build and runtime environments. Build tools should NOT be in production images.
Container Image Construction
Container Orchestration
.dockerignore file1. Multi-Stage Builds (MANDATORY):
2. Minimal Base Images:
3. Non-Root Users (MANDATORY):
4. .dockerignore (MANDATORY):
.git, node_modules, __pycache__5. Layer Optimization:
&&CRITICAL: Before using base images, verify latest versions:
Use WebSearch or WebFetch to verify current versions.
For detailed language-specific optimization patterns, see the dedicated skills:
| Language | Skill | Key Optimization | Typical Reduction |
|---|---|---|---|
| Go | go-containers | Static binaries, scratch/distroless | 846MB → 2.5MB (99.7%) |
| Node.js | nodejs-containers | Alpine, multi-stage, npm/yarn/pnpm | 900MB → 100MB (89%) |
| Python | python-containers | Slim (NOT Alpine), uv, venv | 1GB → 100MB (90%) |
Choose the right base image:
scratch or distroless/static (2-5MB)node:XX-alpine (50-150MB)python:XX-slim (80-120MB) - Never use Alpine for Python!nginx:XX-alpine (20-40MB)scratch or nginx:alpine (minimal)Start from the annotated builder/runtime template in references/multi-stage-template.md (non-root user, COPY --from=builder, HEALTHCHECK), then meet every requirement below.
Security Requirements (Mandatory)
node:20.10-alpine), never latestTypical Impact of Full Optimization:
12-Factor App Principles
Skaffold Preference
When a scan flags a package whose fix is published but the base tag predates it, bump the base tag if upstream has rebuilt it; otherwise upgrade the package in place and fail the build if the installed version is still old, since apt-get install --only-upgrade exits 0 when the fix is not in an enabled repository. Runtimes with their own root store (Python certifi, Java cacerts, Node.js) are not fixed by the OS ca-certificates package. Snippets, the verify step and the removal comment: references/cve-patching.md.
When publishing to GHCR or adding image metadata, use references/oci-labels.md: the required (org.opencontainers.image.source, .description, .licenses) and recommended labels, and how to set them in a Dockerfile, at build time, or via docker/metadata-action.
When building and testing containers, use these optimizations for faster feedback:
| Context | Command | Purpose |
|---|---|---|
| Quick build | DOCKER_BUILDKIT=1 docker build --progress=plain -t app . | BuildKit with plain output |
| Build with cache | docker build --cache-from app:latest -t app:new . | Reuse layers from previous builds |
| Security scan | docker scout cves app:latest | head -50 | Quick vulnerability check |
| Size analysis | docker images app --format "{{.Size}}" | Check image size |
| Layer inspection | docker history app:latest --human --no-trunc | Analyze layer sizes |
| Build without cache | docker build --no-cache --progress=plain -t app . | Force clean build |
| Test container | docker run --rm -it app:latest /bin/sh | Interactive testing |
| Quick health check | docker run --rm app:latest timeout 5 /health | Verify startup |
Build optimization flags:
--target=<stage>: Build specific stage only (faster iteration)--build-arg BUILDKIT_INLINE_CACHE=1: Enable inline cache--secret id=key,src=file: Mount secrets without including in imageFor detailed Dockerfile optimization techniques, orchestration patterns, security hardening, and Skaffold configuration, see REFERENCE.md.
Language-Specific Container Optimization:
go-containers - Go static binaries, scratch/distroless (846MB → 2.5MB)nodejs-containers - Node.js Alpine patterns, npm/yarn/pnpm (900MB → 100MB)python-containers - Python slim (NOT Alpine), uv/poetry (1GB → 100MB)/configure:container - Comprehensive container infrastructure validation/configure:dockerfile - Dockerfile-specific configuration/configure:workflows - GitHub Actions including container builds/configure:skaffold - Kubernetes development configurationWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin container-plugin9 skills in this plugin
/deploy-handoffGenerate deployment handoff docs — tech stack, access URLs, config, monitoring, dev checklist. Use when handing off a service, documenting deployments, or creating client-facing summaries./deploy-releaseCreate and publish releases via release-please or manual GitHub releases. Use when cutting a release, tagging a version, or setting up release-please config./go-containersGo container optimization — scratch/distroless images, static binaries, CGO, ldflags, trimpath (846MB to 2.5MB). Use when working with Go containers or optimizing Go image sizes.Other plugins' skills for the same job