Harden Docker/container images and runtime deployments with secure base images, non-root users, CVE scanning, SBOM/signing, seccomp/AppArmor, and Kubernetes pod security controls. Use for Dockerfile s
A production-focused guide for building, scanning, and running containers securely — from Dockerfile authoring through runtime enforcement and supply chain integrity.
Detailed Guide
Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
When to Use This Skill
User mentions Docker security, container hardening, or Dockerfile security review
User asks about distroless images, non-root containers, or read-only filesystems
User wants to scan images for CVEs with Trivy, Grype, or Snyk
User mentions seccomp, AppArmor, Linux capabilities, or runtime security
User asks "is my Dockerfile secure?" or "how do I reduce my image attack surface?"
User wants to sign/verify images with Cosign or generate SBOMs
User asks about Kubernetes pod security, NetworkPolicy, or RBAC hardening
User says "fix container CVEs" or "harden my container for production"
When NOT to Use This Skill
The user is primarily asking about GitHub Actions CI/CD → recommend github-actions-advanced
The user needs general Docker usage help (not security) → recommend docker-expert
The user is working with Kubernetes orchestration beyond security → recommend kubernetes-architect
The user needs application-level security (SQL injection, XSS) → recommend api-security-best-practices
Security Checklist
Dockerfile
Minimal base image (distroless, slim, or alpine — not full debian/ubuntu)
Multi-stage build — no build tools, devDependencies, or compilers in runtime image
Non-root USER declared before CMD/ENTRYPOINT
Base image pinned to @sha256:... digest (not just tag)
No secrets in ENV, ARG, or RUN commands
HEALTHCHECK defined
OCI labels present (org.opencontainers.image.*)
.dockerignore excludes .git, .env, secrets, tests
ENTRYPOINT uses exec form, not shell form
Image Scanning
Trivy or Grype scan in CI (fails on HIGH/CRITICAL)
Hadolint passes with no warnings
Secret scan run on image (trivy --scanners secret)
SBOM generated and stored
.trivyignore has justified entries for accepted CVEs
Runtime
--read-only filesystem
--cap-drop ALL (add back only what's documented as required)
--security-opt no-new-privileges:true
--security-opt seccomp=<profile> applied
Resource limits set (--memory, --cpus, --pids-limit)
Image signed with Cosign; verified before deploy
Kubernetes
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true with explicit UID
capabilities.drop: ["ALL"]
Resource requests and limits defined
automountServiceAccountToken: false
Namespace PSA enforced at restricted level
NetworkPolicy default-deny applied
RBAC uses specific resource names and minimal verbs
Limitations
Use this skill only when the task clearly matches the scope described above.
Do not treat the output as a substitute for environment-specific penetration testing or a formal security audit.
Seccomp profiles and AppArmor are Linux-only; macOS/Windows Docker Desktop uses different mechanisms.
Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---
2name: container-security-hardening
3description: Harden Docker/container images and runtime deployments with secure base images, non-root users, CVE scanning, SBOM/signing, seccomp/AppArmor, and Kubernetes pod security controls. Use for Dockerfile s
4category: Security & Systems
5source: antigravity
6tags: [api, ai, document, image, security, docker, kubernetes]
7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/container-security-hardening
8metadata:
9 source: https://skillmd.com/skills/sickn33/container-security-hardening
10---
111213# Container Security Hardening Skill
1415A production-focused guide for building, scanning, and running containers securely — from Dockerfile authoring through runtime enforcement and supply chain integrity.
1617---
1819## Detailed Guide
2021Read [the detailed guide](references/detailed-guide.md) before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
2223## When to Use This Skill
2425- User mentions Docker security, container hardening, or Dockerfile security review
26- User asks about distroless images, non-root containers, or read-only filesystems
27- User wants to scan images for CVEs with Trivy, Grype, or Snyk
28- User mentions seccomp, AppArmor, Linux capabilities, or runtime security
29- User asks "is my Dockerfile secure?" or "how do I reduce my image attack surface?"
30- User wants to sign/verify images with Cosign or generate SBOMs
31- User asks about Kubernetes pod security, NetworkPolicy, or RBAC hardening
32- User says "fix container CVEs" or "harden my container for production"
3334## When NOT to Use This Skill
3536- The user is primarily asking about GitHub Actions CI/CD → recommend `github-actions-advanced`
37- The user needs general Docker usage help (not security) → recommend `docker-expert`
38- The user is working with Kubernetes orchestration beyond security → recommend `kubernetes-architect`
39- The user needs application-level security (SQL injection, XSS) → recommend `api-security-best-practices`
4041---
4243## Security Checklist
4445### Dockerfile
46- [ ] Minimal base image (distroless, slim, or alpine — not full debian/ubuntu)
47- [ ] Multi-stage build — no build tools, devDependencies, or compilers in runtime image
48- [ ] Non-root `USER` declared before `CMD`/`ENTRYPOINT`
49- [ ] Base image pinned to `@sha256:...` digest (not just tag)
50- [ ] No secrets in `ENV`, `ARG`, or `RUN` commands
51- [ ] `HEALTHCHECK` defined
52- [ ] OCI labels present (`org.opencontainers.image.*`)
53- [ ] `.dockerignore` excludes `.git`, `.env`, secrets, tests
54- [ ] `ENTRYPOINT` uses exec form, not shell form
5556### Image Scanning
57- [ ] Trivy or Grype scan in CI (fails on HIGH/CRITICAL)
58- [ ] Hadolint passes with no warnings
59- [ ] Secret scan run on image (`trivy --scanners secret`)
60- [ ] SBOM generated and stored
61- [ ] `.trivyignore` has justified entries for accepted CVEs
6263### Runtime
64- [ ] `--read-only` filesystem
65- [ ] `--cap-drop ALL` (add back only what's documented as required)
66- [ ] `--security-opt no-new-privileges:true`
67- [ ] `--security-opt seccomp=<profile>` applied
68- [ ] Resource limits set (`--memory`, `--cpus`, `--pids-limit`)
69- [ ] Image signed with Cosign; verified before deploy
7071### Kubernetes
72- [ ] `readOnlyRootFilesystem: true`
73- [ ] `allowPrivilegeEscalation: false`
74- [ ] `runAsNonRoot: true` with explicit UID
75- [ ] `capabilities.drop: ["ALL"]`
76- [ ] Resource `requests` and `limits` defined
77- [ ] `automountServiceAccountToken: false`
78- [ ] Namespace PSA enforced at `restricted` level
79- [ ] `NetworkPolicy` default-deny applied
80- [ ] RBAC uses specific resource names and minimal verbs
8182---
8384## Limitations
8586- Use this skill only when the task clearly matches the scope described above.
87- Do not treat the output as a substitute for environment-specific penetration testing or a formal security audit.
88- Seccomp profiles and AppArmor are Linux-only; macOS/Windows Docker Desktop uses different mechanisms.
89- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Run npx get-skill add sickn33/container-security-hardening in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Harden Docker/container images and runtime deployments with secure base images, non-root users, CVE scanning, SBOM/signing, seccomp/AppArmor, and Kubernetes pod security controls. Use for Dockerfile s It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
sickn33 (@sickn33) published this skill. Their other Agent Skills are listed on their SkillMD profile.