dockerfile-hardener

dockerfile-hardener is an agent for Claude Code from sigistry/marketplace. It costs 0 tokens per session (1,218 once invoked), scanned A, original, MIT.

An agent that rewrites Dockerfiles and adds a matching .dockerignore to improve container build and runtime settings. A Dockerfile is the recipe used to build a container image, and .dockerignore excludes unnecessary files from that image.

In plain words
What is it for?
Use it to harden a Dockerfile, reduce image size, run the application as a non-root user, pin its base image, improve build caching, or add a health check where supported.
Why use it?
Container recipes can create oversized images, run processes with too much access, leak files or secrets, and rebuild slowly. The agent addresses these risks through build stages, permissions, caching, and cleaner inputs.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the ci-incident-medic plugin — 4 skills, 5 commands, 3 agents shipped together

Good fit Use it to harden a Dockerfile, reduce image size, run the application as a non-root user, pin its base image, improve build caching, or add a health check where supported.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/sigistry/marketplace/dockerfile-hardener
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.

Clone the repo
git clone --depth 1 https://github.com/sigistry/marketplace

Made for: Claude Code.

Or install ci-incident-medic, the plugin that ships this one along with the rest of its 4 skills, 5 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dockerfile-hardener

README.md
[![agentmods](https://agentmods.dev/badge/agents/sigistry/marketplace/dockerfile-hardener.svg)](https://agentmods.dev/agents/sigistry/marketplace/dockerfile-hardener)
Your own site
<a href="https://agentmods.dev/agents/sigistry/marketplace/dockerfile-hardener"><img src="https://agentmods.dev/badge/agents/sigistry/marketplace/dockerfile-hardener.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,218 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01218
Opus 5 $0.00000 $0.00609
Sonnet 5 $0.00000 $0.00244
Haiku 4.5 $0.00000 $0.00122

Measured 8d ago against content hash fb26bbb9dc3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

dockerfile-hardener 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 8d ago.

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.

plugins/ci-incident-medic/agents/dockerfile-hardener.md · 70 lines

How it starts

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

You are a container build engineer who makes images small, reproducible, and secure by default. You rewrite Dockerfiles in place and produce a matching .dockerignore, and you justify every change with the concrete win it buys.

Your Core Responsibilities:

  1. Convert single-stage builds to multi-stage: heavy toolchain in the build stage, only artifacts in the runtime stage.
  2. Enforce a non-root runtime (USER with a numeric UID) and least privilege.
  3. Pin the base image to a digest for reproducibility.
  4. Reorder layers for maximum cache reuse (dependencies before source).
  5. Ensure no secrets are baked into any layer.
  6. Emit a matching .dockerignore and add a HEALTHCHECK where the process supports one.

Analysis Process:

  1. Read the Dockerfile and detect the ecosystem from FROM and copied manifests.
  2. Inventory the smells (root user, latest/unpinned tag, single stage, COPY . . before dep install, secrets, uncleaned package caches, missing .dockerignore/HEALTHCHECK).
  3. Choose a runtime base: distroless or -slim/alpine where compatible; keep glibc when the app needs it (avoid musl surprises for Python wheels / CGO).
  4. Rewrite via Edit: split stages, pin, reorder, add USER, clean package caches in the same RUN, and copy only the built artifact into the final stage.
  5. Generate .dockerignore covering VCS, deps, build output, local env/secrets.
  6. Preserve the runtime contract: entrypoint, EXPOSEd port, and required runtime files must survive the copy.

Ecosystem-specific hardening (see the dockerfile-smells skill's multistage-patterns.md for full templates):

  • Node: build stage runs npm ci (cache-mount), prune dev deps or copy only node_modules prod tree; runtime on gcr.io/distroless/nodejs or node:-slim, USER node/numeric UID.
  • Python: build wheels in a builder, pip install --no-cache-dir into a venv, copy the venv to a python:-slim runtime; never pip as root at runtime.
  • Go: CGO_ENABLED=0 go build static binary in golang: builder → FROM scratch or gcr.io/distroless/static:nonroot.
  • Java/JVM: build with the JDK, use jlink/jdeps for a trimmed runtime or a JRE base; run as non-root.
  • Rust: cargo build --release in a rust: builder → distroless/scratch with the static binary.

.dockerignore baseline: .git, .github, node_modules, target, dist, build, __pycache__, *.env, .env*, *.log, Dockerfile, .dockerignore, local secrets and credentials.

Output Format:

Dockerfile Hardening

Read the full file on GitHub · 70 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. 8d ago First seen · 70 lines · 0 tokens per session scan A fb26bbb9dc3b

Subscribe to this mod's changes

dockerfile-hardener is an agent published in the GitHub repository sigistry/marketplace (3 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,218 tokens. 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.

Related

Other agents, from other repositories

build-orchestrator

Use this agent when you need assistance with Docker and Make command management during development. This includes analyzing Dockerfiles for optimization opportunities, managing container lifecycles, handling volumes and data persistence, monitoring logs, and determining when rebuilds are necessary versus simple…

andisab/swe-marketplace · 355 tokens

implementation-agent

Strict implementation agent that executes coding tasks following requirements exactly without improvisation, asking for clarification when needed.

NikiforovAll/claude-code-rules · 22 tokens

context-agent

Use this agent to analyze, maintain, and update CLAUDE.md files that provide essential context and guidance for Claude Code when working with a repository. This agent ensures documentation stays synchronized with project evolution, maintains consistency, and optimizes Claude Code's understanding of the codebase.…

andisab/swe-marketplace · 429 tokens

unity-reviewer

Unity-specific code reviewer focusing on MonoBehaviour patterns, serialization, performance, and Unity best practices. Use after implementing Unity code to catch Unity-specific issues.

DmitriyYukhanov/claude-plugins · 34 tokens

typescript-reviewer

TypeScript-specific code reviewer focusing on type safety, async patterns, and frontend best practices. Use after implementing TypeScript code to catch TypeScript-specific issues.

DmitriyYukhanov/claude-plugins · 35 tokens

review-software-architect

Review persona: senior software architect lens for any codebase. Use for architecture review or grading of a project's shape: folder structure and module boundaries, naming, convention vs configuration, SOLID, coupling and cohesion, functional vs OOP coherence, domain-driven design, immutable vs mutable state…

simiancraft/simiancraft-skills · 117 tokens