container-hardening
Skill15 starsChanged 3 months agoMITView on GitHub
Harden container images and runtime configuration. Use when building, reviewing, or auditing Containerfiles, Dockerfiles, container compose files, or Kubernetes pod security settings.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- roodlicht/accans-sec-skillstheir own version, first seen May 7, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- roodlicht/accans-sec-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-code-reviewSkill
- architectSkill
- auditSkill
- build-yaml-misconfigurationSkill
- client-side-securitySkill
- compliance-checkSkill
- dependency-auditSkill
- fixSkill
- input-validation-injectionSkill
- receiving-code-reviewSkill
- retroSkill
- secrets-scanSkill
- secure-reviewSkill
- semgrepSkill
- shipSkill
- syncSkill
- threat-model-gateSkill
- threat-modelSkill
- verification-before-completionSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use a Universal Base Image (UBI) from the official Red Hat Container Registry
- Very specific: line 14
Prefer ubi-minimal (ubi8/ubi-minimal or ubi9/ubi-minimal) to reduce attack surface
- Distinctive: line 15
Use the most up-to-date image available
- Distinctive: line 26
Remove non-essential packages and clean up package manager caches:
- Very specific: line 35
Use microdnf on ubi-minimal images.
- Distinctive: line 57
Use read-only root filesystems wherever possible:
- Distinctive: line 79
Use Hadolint to lint Containerfiles for best-practice violations and inline bash issues:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Container Hardening
Base Image Selection
- Use a Universal Base Image (UBI) from the official Red Hat Container Registry
- Prefer ubi-minimal (
ubi8/ubi-minimalorubi9/ubi-minimal) to reduce attack surface - Use the most up-to-date image available
Image Tagging Strategy
| Source | Strategy |
| Red Hat Catalog | Omit floating tags to get the latest image; exception: Konflux project uses digest-based pinning with automated updates |
| Non-Red Hat registries | Pin the version or digest to ensure you use the intended image and not a tampered one |
Minimize Installed Software
Remove non-essential packages and clean up package manager caches:
RUN microdnf upgrade -y && \
microdnf install -y <required-packages> && \
microdnf remove -y <unnecessary-packages> && \
microdnf clean allUse microdnf on ubi-minimal images; dnf on full UBI images.
Runtime Security
Privilege Restrictions
Set no-new-privileges to prevent privilege escalation during container execution:
securityContext:
allowPrivilegeEscalation: falseOr in a compose file:
security_opt:
- no-new-privileges: trueRead-Only Filesystem
Use read-only root filesystems wherever possible:
securityContext:
readOnlyRootFilesystem: trueMount writable tmpfs volumes only where the application requires write access (e.g., /tmp, /var/run).
Read-Only Volumes
Mount volumes as read-only unless the container must write to them:
volumeMounts:
- name: config
mountPath: /etc/app
readOnly: trueContainerfile Linting
Use Hadolint to lint Containerfiles for best-practice violations and inline bash issues:
hadolint ContainerfileHadolint catches common issues (running as root, missing version pins, unnecessary sudo) but should not be trusted without additional verification.
Implementation Checklist
- Base image is a Red Hat UBI from the official catalog
- ubi-minimal is used unless a full UBI is justified
- Non-Red Hat base images are pinned by version or digest
- Non-essential packages are removed and caches cleaned
allowPrivilegeEscalation: false(no-new-privileges) is setreadOnlyRootFilesystem: trueis set- Volumes are mounted read-only unless writes are required
- A numeric non-root
USERis set in the Containerfile - Hadolint runs in CI on all Containerfiles
- Container images are rebuilt regularly to pick up base image updates
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

