docker-development

Instructions for building and reviewing Dockerfiles and Docker Compose configurations. Docker packages applications and their dependencies into containers, while Compose defines groups of containers and how they run together.

In plain words
What is it for?
Use it when creating or optimising container builds, setting up multi-container development, checking Docker security, or reducing image size.
Why use it?
It helps reduce unnecessary image contents, improve build caching, and run production containers with fewer security risks. It recommends separating build tools from the final runtime image and avoiding root where appropriate.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tmj-90/gaffer/docker-development
Any agent
npx skills add tmj-90/gaffer --skill docker-development
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 964 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00060 $0.00964
Opus 5 $0.00030 $0.00482
Sonnet 5 $0.00012 $0.00193
Haiku 4.5 $0.00006 $0.00096

Measured yesterday against content hash 3fdc7f954715, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docker-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/docker-development/SKILL.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Smaller images. Faster builds. Secure containers.

Opinionated Docker workflow — turn bloated Dockerfiles into production-grade containers. Three concerns: size, speed (build cache), security.

Multi-stage build pattern (every production image)

# --- build stage ---
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build

# --- runtime stage ---
FROM node:22-alpine AS runtime
RUN addgroup -S app && adduser -S -G app app
WORKDIR /app
COPY --from=build --chown=app:app /app/dist ./dist
COPY --from=build --chown=app:app /app/node_modules ./node_modules
USER app
EXPOSE 3000
CMD ["node", "dist/main.js"]

Key principles:

  • Build tools and source code stay in the build stage; only the artifact ships.
  • Non-root user (USER app) in the runtime stage.
  • .dockerignore excludes node_modules/, .git/, *.md, test files.

Layer caching discipline

  1. Copy dependency manifests first (package.json, pnpm-lock.yaml) — before source code.
  2. Run install — cache busts only on lockfile change.
  3. Copy source — cache busts on any source change.
  4. Build — always after source copy.

Violating this order invalidates cache on every source change.

Security hardening

Control Implementation
Non-root user addgroup/adduser + USER directive
Read-only filesystem --read-only flag at runtime; explicit tmpfs mounts where needed
No secrets in layers Build args for values; never ENV SECRET=...; use runtime secrets injection
Minimal base image alpine or distroless; never latest tag
Pin digest FROM node:22-alpine@sha256:... for reproducibility
Scan at build docker scout or trivy in CI; block on HIGH/CRITICAL CVEs

Steps

  1. Read the lore + existing Dockerfile. search_lore for existing build conventions, base image choices, and registry. Extend; don't duplicate.
  2. Audit the current state. Count layers; identify the base image and its size; check for build tools leaking into the runtime stage; look for secrets in ENV or RUN commands.
  3. Apply multi-stage build. Separate build from runtime. If only one stage is needed (static binary), still use an explicit base and non-root user.
  4. Order for cache. Dependencies before source; COPY --link where supported.
  5. Harden. Non-root user; minimal runtime image; no secrets in layers; read-only where practical.
  6. Compose (if needed). Health-check every service; use named volumes not bind mounts for data; keep .env.example in version control.
  7. Verify. Build succeeds; image scan clean; container starts and passes health check; record evidence.

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 88 lines · 60 tokens per session scan A 3fdc7f954715

Subscribe to this mod's changes

docker-development is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 7d ago), licensed Apache-2.0. It adds 60 tokens to every session and 964 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.