/major-ai-skills:dockerfrom major-ai-skills
Build reproducible container images with BuildKit, wire Compose service graphs with readiness gates, and debug networking, volumes, and layer-cache failures.
Ships in major-ai-skills. 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.
Docker packages apps as immutable images and runs them as ephemeral containers on a host engine (containerd/Moby). BuildKit builds images with cache mounts and multi-stage targets; Compose declares multi-container graphs on a single host. Agents should treat images as versioned artifacts (digest-pinned bases), Compose as startup-order contracts (not “wait forever”), and secrets as runtime mounts—never committed layers.
┌─────────────────────────────────────────────────────────────┐
│ Docker build → run loop │
│ │
│ Build (BuildKit / buildx) │
│ ├── Multi-stage: deps → build → runner (non-root) │
│ ├── Cache: lockfiles first; RUN --mount=type=cache │
│ └── SBOM/scan gate before push (pair with @trivy) │
│ │
│ Runtime │
│ ├── Namespaces: net / pid / mnt; USER in final stage │
│ ├── Volumes: named > bind (UID/GID traps on bind) │
│ └── HEALTHCHECK + Compose condition: service_healthy │
│ │
│ Compose orchestration (single host) │
│ ├── depends_on + healthcheck (startup only, not runtime) │
│ └── Internal DNS: <service> on user-defined network │
└─────────────────────────────────────────────────────────────┘
Use when
.dockerignore, and compose.yaml for local/staging parity.Do not use when
@kubernetes / @helm.ENV or ARG defaults → refuse; use secrets mounts or external secret stores (@vault).node:20-alpine today ≠ tomorrow) breaks reproducibility and CVE response.runner; run as non-root with explicit USER.depends_on.condition: service_healthy with healthchecks that prove application readiness (pg_isready, HTTP /health), not “process started”.start_period + retries: Compose stops startup if dependency goes unhealthy after retries—it does not wait indefinitely.RUN --mount=type=secret for npm/pip tokens; never COPY .env or ENV TOKEN=.docker compose up --build vs pull policy; use named volumes for stateful data.docker buildx build --platform linux/amd64,linux/arm64 when CI arch ≠ laptop (Apple Silicon → amd64 deploy traps).Dockerfile (excerpt):
# syntax=docker/dockerfile:1
FROM node:20-alpine@sha256:<pin-digest> AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
FROM node:20-alpine@sha256:<pin-digest> AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -S app && adduser -S app -G app
COPY --from=deps /app/node_modules ./node_modules
COPY --chown=app:app dist ./dist
USER app
EXPOSE 3000
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=3 \
CMD wget -qO- http://127.0.0.1:3000/health || exit 1
CMD ["node", "dist/server.js"]
compose.yaml:
services:
api:
build:
context: .
target: runner
ports: ["3000:3000"]
environment:
DATABASE_URL: postgres://app@db:5432/app
secrets: [db_password]
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/health"]
interval: 10s
start_period: 30s
retries: 5
db:
image: postgres:16-alpine@sha256:<pin-digest>
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
POSTGRES_DB: app
secrets: [db_password]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d app"]
interval: 5s
timeout: 5s
retries: 10
start_period: 30s
volumes: [pgdata:/var/lib/postgresql/data]
secrets:
db_password:
file: ./secrets/db_password.txt # gitignored
volumes:
pgdata:
Validation loop:
docker compose config
docker buildx build -t myorg/api:$(git rev-parse --short HEAD) --target runner .
docker compose up --build -d
docker compose ps
docker inspect --format='{{json .State.Health}}' "$(docker compose ps -q api)"
| Signature | Likely cause | Fix path |
|---|---|---|
Dependency unhealthy, compose aborts startup | Healthcheck too aggressive vs slow boot | Increase start_period, fix test command, verify port inside container |
connection refused to db:5432 on first boot only | Short-form depends_on without service_healthy | Add condition: service_healthy |
| After host reboot, logging driver / syslog race | Engine starts containers without Compose ordering | Do not model engine plugins as Compose services; use host syslog |
permission denied on bind mount | UID/GID mismatch (USER app vs host root-owned dir) | Named volume, or chown host path, or align UID |
| Image 2GB+ | Build tools in final stage | Multi-stage; .dockerignore; npm prune --omit=dev |
no matching manifest for linux/amd64 | arm64-only image on amd64 cluster | buildx --platform or pin correct base |
Secrets in docker history | ENV/ARG for credentials | BuildKit secrets; runtime env from orchestrator |
| Nginx/upstream “host not found” at start | Static upstream DNS at boot | Pair with @nginx resolver pattern in frontends |
.dockerignore: .git, node_modules, *.pem, .env*, test fixtures.@kubernetes, @github-actions).docker scout cves or @trivy in CI before push.read_only: true + tmpfs for stateless services when feasible.@kubernetes — production orchestration beyond single-host Compose@github-actions — build/push images with OIDC to cloud registries@nginx — reverse proxy in front of compose stacks@trivy — image vulnerability gates@vault — dynamic secrets instead of compose secret files in prodMANDATORY: Pin base image digests for production paths. Never put secrets in image layers or committed compose env. Use
depends_onwithservice_healthyand healthchecks that reflect real readiness; tunestart_periodso slow deps are not marked unhealthy during boot. Validate withdocker compose configandnginx -t-equivalent (docker build+ container health) before declaring success.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing./add-your-own-human-voiceRevise AI-assisted writing to preserve the author's voice, concrete experience, and intended tone./adobe-after-effectsScaffold After Effects comps and expression rigs, queue Render Queue / AME jobs, and export Essential Graphics (.mogrt) with ExtendScript-safe patterns.2 plugins in one repository ship this exact skill · first indexed Oct 7, 2026