wrongstack/wrongstack/container-hardening
Claude Code and agent skill by wrongstack/wrongstack
- community
Checking that the SKILL.md file is still in the repository.
Review and improve container image/runtime protection for an owned application with tested compatibility. Use when reducing privileges, protecting secrets or setting container resource/exposure policies; do not label every hardening preference a confirmed vulnerability.
Install
npx vskill@latest install wrongstack/wrongstack/container-hardeningSKILL.md
Container Hardening
Selection card
- Task: Reduce container privilege and secret exposure.
- Start: Identify the authorized target, current health and rollback boundary.
- Finish: apply the acceptance checks below; report observed results and unresolved constraints.
Overview
Container hardening minimizes the runtime blast radius of an application image and its container execution profile by stripping build-time toolchains, running as an unprivileged numeric USER, enforcing no-new-privileges and capability drops (cap_drop: [ALL]), mounting the root filesystem read-only where compatible, and keeping secrets out of image layers.
Use current Docker/OCI/runtime documentation and the deployed platform version. Checked Docker target: 29.9.2; apply settings supported by the actual runtime.
Rules
- Inventory the application's actual runtime requirements (listening port >= 1024, writable temp/cache paths, outbound network needs, native shared libraries) before applying restrictions.
- Run as a non-root numeric UID/GID (
USER 10001:10001), setread_only: true(--read-only) with boundedtmpfsmounts (/tmp:rw,noexec,nosuid,size=64m) where compatible, and setsecurity_opt: ["no-new-privileges:true"]. - Drop Linux capabilities (
cap_drop: ["ALL"]) and re-add only explicitly verified capabilities; never enableprivileged: true, host network/PID namespaces, or/var/run/docker.sockmounts for ordinary application workloads. - Pass build-time credentials exclusively via BuildKit secret mounts (
RUN --mount=type=secret,id=...) and runtime credentials via mounted secrets/environment files—never via DockerfileARGorENVinstructions that persist indocker history/ image metadata. - Configure explicit memory, CPU, and PID limits (
mem_limit,pids_limit) so a runaway process or fork bomb cannot starve the host. - Pin base images by version tag and SHA-256 digest (
image:tag@sha256:...), and evaluate CVE scanner findings by actual reachability and runtime stage presence rather than raw uncontextualized counts.
Core Patterns & Pitfalls
- Read-Only Rootfs Compatibility: Many runtimes write temporary files, JIT caches, or PID files by default (e.g.,
/tmp, Nginx/var/cache/nginx&/run, Python bytecode). Testread_only: trueagainst the real startup, request, and graceful-shutdown paths with targetedtmpfsor volume mounts. - Layer Secret Persistence: Deleting a secret file in a later
RUN rm /root/.npmrclayer does not remove it from the image tarball; an earlier layer still contains the secret unless--mount=type=secretor a separate non-shipped build stage was used. - Anti-pattern — Breaking Production Healthchecks in Distroless Images: Switching a final stage to
distrolessorscratchremoves/bin/sh,curl, andwget; ensure container healthchecks use a built-in binary subcommand (["/app/server", "healthcheck"]) or orchestrator HTTP probe before removing shell utilities.
Workflow
- Inspect image/config and the actual exposure/ownership boundary.
- Record current privileges and source-supported risks.
- Apply a coherent narrow restriction set and rebuild/run the application.
- Exercise startup, persistence, shutdown and necessary network/device operations.
- Report implemented protections, compatibility checks and remaining justified privileges.
Before returning
- [ ] No secrets or private tokens present in Dockerfile
ARG/ENVor exported image layers (docker history) - [ ] Container runs as non-root UID/GID on an unprivileged port with
no-new-privilegesand minimal capabilities - [ ]
read_onlyrootfs,tmpfswritable paths, andmem_limit/pids_limitverified against real app startup and requests - [ ] Base image pinned and final runtime stage free of unnecessary compilers, package managers, or dev dependencies
- [ ] Verified vulnerabilities distinguished from defence-in-depth hardening recommendations
Sources
Versioned facts checked 2026-10-23; refresh authoritative sources before new installs/upgrades. Docker security, Build secrets.
Skills in scope
- security-scanner — review owned source, configuration and dependency metadata for supported security findings with precise evidence and remediation.
- docker-deploy — multi-stage Dockerfile construction, BuildKit caching, and runtime entrypoint setup.
- compose-operations — operate and evolve multi-service Docker Compose environments with explicit networks, volumes and environment boundaries.
- kubernetes-operations — operate and deploy owned Kubernetes workloads with explicit cluster, namespace and rollout identity.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/core/skills/container-hardening/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/wrongstack/wrongstack/container-hardening)