container-hardening

container-hardening is a skill for Claude Code, Codex from BagelHole/DevOps-Security-Agent-Skills. It costs 38 tokens per session (543 once invoked), scanned B, original, MIT.

A guide for securing Docker images and the containers that run them. Containers package an application with its dependencies so it can run consistently across environments.

In plain words
What is it for?
Use it to build smaller images, run applications as non-root users, make filesystems read-only, and apply safer Docker or Kubernetes runtime settings.
Why use it?
It reduces the damage a vulnerable application or container could cause by limiting privileges, filesystems, and system capabilities.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build smaller images, run applications as non-root users, make filesystems read-only, and apply safer Docker or Kubernetes runtime settings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bagelhole/devops-security-agent-skills/container-hardening
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.

Any agent
npx skills add BagelHole/DevOps-Security-Agent-Skills --skill container-hardening
Clone the repo
git clone --depth 1 https://github.com/BagelHole/DevOps-Security-Agent-Skills

Made for: Claude Code, Codex.

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 container-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/bagelhole/devops-security-agent-skills/container-hardening/github.svg)](https://agentmods.dev/skills/bagelhole/devops-security-agent-skills/container-hardening)
Your own site
<a href="https://agentmods.dev/skills/bagelhole/devops-security-agent-skills/container-hardening"><img src="https://agentmods.dev/badge/skills/bagelhole/devops-security-agent-skills/container-hardening/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for container-hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/bagelhole/devops-security-agent-skills/container-hardening"><img src="https://agentmods.dev/badge/skills/bagelhole/devops-security-agent-skills/container-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 543 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 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.00038 $0.00543
Opus 5 $0.00019 $0.00271
Sonnet 5 $0.00008 $0.00109
Haiku 4.5 $0.00004 $0.00054

Measured 9d ago against content hash 7321c458d21a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade B, and why

container-hardening scanned grade B with 2 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 9d 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.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

# Don't run as root

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Recursive force deletemediumDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf /var/cache/apk/*

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

security/hardening/container-hardening/SKILL.md · 103 lines

What it actually says

Container Hardening

Secure container images and runtime configurations.

When to Use This Skill

Use this skill when:

  • Building secure container images
  • Hardening container deployments
  • Meeting container security requirements
  • Implementing defense in depth

Dockerfile Security

# Use minimal base image
FROM alpine:3.18

# Don't run as root
RUN addgroup -g 1001 -S appgroup && \
    adduser -u 1001 -S appuser -G appgroup

# Copy with specific ownership
COPY --chown=appuser:appgroup . /app

# Remove unnecessary packages
RUN apk del --purge build-dependencies && \
    rm -rf /var/cache/apk/*

# Use non-root user
USER appuser

# Read-only filesystem support
WORKDIR /app

Runtime Security

# Run with security options
docker run -d \
  --read-only \
  --tmpfs /tmp \
  --security-opt=no-new-privileges:true \
  --cap-drop=ALL \
  --cap-add=NET_BIND_SERVICE \
  --user 1001:1001 \
  myapp:latest

Kubernetes Security Context

apiVersion: v1
kind: Pod
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1001
    fsGroup: 1001
  containers:
  - name: app
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities:
        drop: ["ALL"]

Image Scanning

# Scan with Trivy
trivy image --severity HIGH,CRITICAL myapp:latest

# Use distroless images
FROM gcr.io/distroless/static-debian11

Best Practices

  • Use minimal base images
  • Run as non-root user
  • Enable read-only filesystem
  • Drop all capabilities
  • Scan images regularly
  • Sign and verify images
  • Use secrets management
Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 9d ago First seen · 103 lines · 38 tokens per session scan B 7321c458d21a

Subscribe to this mod's changes

container-hardening is a skill published in the GitHub repository BagelHole/DevOps-Security-Agent-Skills (1,084 stars, last pushed 3mo ago), licensed MIT. It adds 38 tokens to every session and 543 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.