containerization-docker

Enforces multi-stage, pinned, non-root Dockerfile conventions for reproducible minimal runtime images.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/balajirags/aifsd-kit --skill containerization-docker-balajirags
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: containerization-docker
Source: https://github.com/balajirags/aifsd-kit/tree/main/docs/skills/containerization-docker
Command: npx skills add https://github.com/balajirags/aifsd-kit --skill containerization-docker-balajirags

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dockerfiles written ad hoc often produce bloated, non-reproducible images that run as root, leak secrets into layers, and break cache efficiency on every code change. This Skill provides a concrete rule set and anti-pattern list so generated or reviewed Dockerfiles follow secure, reproducible containerization practices. ## Core Features & Use Cases - Multi-stage build conventions: Separates builder and runtime stages so compilers, SDKs, and source never ship in the final image. - Reproducibility and caching rules: Pins exact base-image tags and orders instructions so dependency layers stay cached across code-only changes. - Security hardening: Enforces non-root users, .dockerignore coverage, secret handling outside image layers, and HEALTHCHECK wiring. - Use Case: When containerizing a Java/Gradle service, apply the rules to produce a pinned eclipse-temurin multi-stage Dockerfile with a non-root user, cached dependency layer, and an HTTP health check. ## Quick Start Write a production Dockerfile for my application following the containerization-docker rules for multi-stage builds, pinned base images, and non-root execution.

Frequently Asked Questions about containerization-docker

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

FAQPage Schema
How do I write a multi-stage Dockerfile for a Java application?

Use a JDK image like eclipse-temurin:21-jdk-alpine as the build stage to compile the jar, then copy only the built artifact into a JRE-based runtime stage. This keeps compilers and source code out of the final image.

Why should I pin Docker base image tags instead of using latest?

A floating tag like latest can resolve to a different image tomorrow, breaking reproducible builds. Pinning an exact tag such as eclipse-temurin:21-jre-alpine guarantees the same base image on every build.

How do I pass secrets to a Docker build without leaking them?

Never bake secrets into image layers via ARG or ENV, since they remain recoverable from layer history. Pass secrets at runtime through environment variables or mounted secrets, or use a build-time secret mount that is not persisted in a layer.

Why does my Docker build cache keep invalidating on code changes?

Copying the entire repo with COPY . . before installing dependencies invalidates the dependency layer on every source change. Copy dependency manifests first, install, then copy application source so the dependency layer stays cached.

Should containers run as root or a non-root user?

Containers should run as a non-root user via the USER instruction. Running as root means a container escape or remote code execution gains root privileges inside and potentially outside the container.