container-hardening

Solid

Harden container images and runtime configuration. Use when building, reviewing, or auditing Containerfiles, Dockerfiles, container compose files, or Kubernetes pod security settings.

AI & Automation 15 stars 2 forks Updated today MIT

Install

View on GitHub

Quality Score: 81/100

Stars 20%
40
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Container Hardening ## Base Image Selection - Use a **Universal Base Image (UBI)** from the official [Red Hat Container Registry](https://catalog.redhat.com/software/containers/search) - Prefer **ubi-minimal** (`ubi8/ubi-minimal` or `ubi9/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: ```dockerfile RUN microdnf upgrade -y && \ microdnf install -y <required-packages> && \ microdnf remove -y <unnecessary-packages> && \ microdnf clean all ``` Use `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: ```yaml securityContext: allowPrivilegeEscalation: false ``` Or in a compose file: ```yaml security_opt: - no-new-privileges: true ``` ### Read-Only Filesystem Use read-only root filesystems wherever possible: ```yaml securityContext: readOnlyRootFilesystem: true ``` Mount writable `tmpfs` volumes only where the application requires write access (e.g., `/tmp`, `/va...

Details

Author
backspace-shmackspace
Repository
backspace-shmackspace/claude-devkit
Created
5 months ago
Last Updated
today
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category