container-security
/container-security
Harden container images and runtime specs with minimal bases, non-root users, read-only filesystems, and dropped capabilities. Use when writing image or Kubernetes security settings or reviewing a container for privilege risk.
- Author
- Amey-Thakur ↗
- Repository
- AI-SKILLS ↗
- Licence
- MIT
- Last repository change
- 05.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Harden container images and runtime specs with minimal bases, non-root users, read-only filesystems, and dropped capabilities. Use when writing image or Kubernetes security settings or reviewing a container for privilege risk.
Original author description
Harden container images and runtime specs with minimal bases, non-root users, read-only filesystems, and dropped capabilities. Use when writing image or Kubernetes security settings or reviewing a container for privilege risk.
How it works
- Method
- Checks
- Boundaries
SKILL.md preview
--- name: container-security description: Harden container images and runtime specs with minimal bases, non-root users, read-only filesystems, and dropped capabilities. Use when writing image or Kubernetes security settings or reviewing a container for privilege risk. --- # Container security A container shares the host kernel, so a breakout turns a compromised app into a compromised node. What an attacker reaches for after landing is privilege and a place to write, so the job is to take both away before they ever get there. ## Method 1. **Build from a minimal base.** Prefer distroless, alpine, or scratch over a full OS image: fewer packages mean fewer CVEs and no shell to pivot from. Scan the final image with Trivy or Grype and fail the build on fixable High or Critical findings. 2. **Run as a non-root user.** Add a `USER` directive with a fixed non-zero uid and set `runAsNonRoot: true` with an explicit `runAsUser` in the Kubernetes securityContext. A process running as uid 0 in the container is uid 0 against any kernel bug. 3. **Mount the root filesystem read-only.** Set `readOnlyRootFilesystem: true` and grant writable tmpfs or volumes only for the paths that truly need writes (`/tmp`, a cache dir). An attacker who cannot write cannot drop a binary to run. 4. **Drop all Linux capabilities and add none back by default.** Use `capabilities: drop: [ALL]` in the securityContext. Most services need zero; add one back only with a written reason, such as `NET_BIND_SERVICE` for a port below 1024. 5. **Forbid privilege escalation and privileged mode.** Set `allowPrivilegeEscalation: false` and `privileged: false`, and refuse `hostPID`, `hostNetwork`, and `hostPath` unless a specific need is reviewed. A privileged container is effectively root on the host. 6. **Set CPU and memory limits per container.** A compromised or runaway workload with no limit can starve every neighbor on the node. Unbounded resources are a denial-of-service condition waiting for a trigger. 7. **Keep secrets out of the image.** Mount them as files from the orchestrator's secret store, never bake them into layers or plain environment variables. Anything `COPY`ed in ships to everyone who can pull the image. ## Checks - Does `docker history` or a layer scan turn up a shell, package manager, or secret in the final image? - Does the container run as non-root with a read-only root filesystem in production? - Are all capabilities dropped, with each one added back individually justified? ## Boundaries This hardens the container and its runtime spec. Dockerfile build hygiene and layer caching belong to containerization; cluster-wide enforcement (admission controllers, Pod Security Standards, network policy) is a platform concern this skill feeds rather than owns.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Amey-Thakur/AI-SKILLS | 90 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| thisiskurubaran/DevSecOps | 100 | MIT |
| snyk/studio-recipes | 100 | Apache-2.0 |
| uw-ssec/rse-plugins | 100 | BSD-3-Clause |
| chrishuffman5/domain-expert | 100 | MIT |
| kyleoliveiro/sg-gov-skills | 90 | MIT |
| susorov/agent-skills | 90 | MIT |
Database snapshot: 13.11.2026 · package version e17f8fe0848b (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100container-hardening
Secure Docker images and container runtime configurations. Implement non-root users, read-only filesystems, and security contexts. Use when building secure container images or hardening container deployments. - 100container-image-hardening
Guides building minimal, non-root, hardened container images — multi-stage builds, distroless/minimal base images, non-root users, read-only root filesystems, dropped Linux capabilities, and pinned/ digest-referenced base images. Use when the user asks to "harden this… - 100container-security-hardening
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 security reviews, container CVEs, image scanning, distroless images, or production hardening. - 91container-security-hardening
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 security reviews, container CVEs, image scanning, distroless images, or production hardening. - 100dockerfile-security-hardening-non-root
Use this skill when harden Dockerfiles by creating non-root users, dropping capabilities, and enabling read-only filesystems. - 100container-hardening
Harden container images and runtime configuration. Use when building, reviewing, or auditing Containerfiles, Dockerfiles, container compose files, or Kubernetes pod security settings.