performing-container-image-hardening

Community

Harden container images with CIS-aligned defaults.

Authorriandeoliveira
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It reduces security risk in production container images by minimizing attack surface, removing unnecessary components, and enforcing least-privilege and baseline CIS configuration controls.

Core Features & Use Cases

  • Multi-stage builds for smaller, safer images: Builds dependencies in a dedicated builder stage and copies only runtime artifacts into a minimal production stage.
  • Hardened runtime posture (non-root, least privilege, safer filesystem): Creates non-root users, drops Linux capabilities, and supports read-only root filesystem patterns (including Kubernetes securityContext examples).
  • CIS Docker Benchmark-aligned validation: Verifies vulnerabilities and misconfiguration issues using tools like Trivy and Dockle, and checks Dockerfile anti-patterns (e.g., pinned digests, avoiding secrets, and discouraging risky commands).
  • Use Case: When migrating from “fat” base images (e.g., full Python/Ubuntu) to slim/distroless variants, this helps cut image size and reduce CVE exposure while improving hardening consistency across services.

Quick Start

Run the provided agent to audit a hardened image by executing: python scripts/agent.py --image your-image:tag --dockerfile path/to/Dockerfile --output report.json

Dependency Matrix

Required Modules

argparsejsonossubprocesssysdatetime

Components

scriptsreferencesassets

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: performing-container-image-hardening
Download link: https://github.com/riandeoliveira/aspnet-template/archive/main.zip#performing-container-image-hardening

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.