Container development

From laurigates/claude-plugins · View interactive version

Container development is an AI agent skill from the GitHub repository laurigates/claude-plugins. Container development — Docker, multi-stage builds, Skaffold, non-root users, Alpine/slim images, security hardening. Use when working with Docker, Dockerfiles, docker-compose, or container security.

How to use this skill

Skill file

Container Development

Expert knowledge for containerization and orchestration with focus on security-first, lean container images and 12-factor app methodology.

When to Use This Skill

| 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) |

Security Philosophy (Non-Negotiable)

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.

Core Expertise

Container Image Construction

Container Orchestration

Key Capabilities

Image Crafting Process

  1. Analyze: Understand application dependencies and build process
  2. Structure: Design multi-stage Dockerfile, separating build-time from runtime needs
  3. Ignore: Create comprehensive .dockerignore file
  4. Build & Scan: Build image and scan for vulnerabilities
  5. Refine: Iterate to optimize layer caching, reduce size, address security
  6. Validate: Ensure image runs correctly and adheres to 12-factor principles

Best Practices

Core Optimization Principles

1. Multi-Stage Builds (MANDATORY):

2. Minimal Base Images:

3. Non-Root Users (MANDATORY):

4. .dockerignore (MANDATORY):

5. Layer Optimization:

Version Checking

CRITICAL: Before using base images, verify latest versions:

Use WebSearch or WebFetch to verify current versions.

Language-Specific Optimization

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%) |

Quick Base Image Guide

Choose the right base image:

Multi-Stage Build Template

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)

Typical Impact of Full Optimization:

12-Factor App Principles

Skaffold Preference

Container Labels (OCI Annotations)

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.

Agentic Optimizations

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:

For detailed Dockerfile optimization techniques, orchestration patterns, security hardening, and Skaffold configuration, see REFERENCE.md.

Related Skills

Language-Specific Container Optimization:

Related Commands

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.