What is Container Hardening: The 2026 Guide to Securing Your Software Supply Chain

By
Minimus

Container hardening is the set of build-time and runtime techniques that reduce the attack surface of a containerized application: minimal base images, dropped Linux capabilities, read-only filesystems, signed images with provenance, and admission policies that enforce all of the above. Done well, hardening turns most "critical" CVE alerts into questions the platform has already answered, instead of tickets a security team has to triage every week.

This guide walks through what container hardening is, the methods that actually move risk down, the controls that map to CIS and NIST SP 800-190, and where source-built minimal images change the economics of the program. The goal is a working hardening checklist, not a vendor pitch.

Key Takeaways

  • Container hardening is the practice of reducing a container image's attack surface by stripping out unneeded packages, dropping kernel privileges, locking the filesystem, and signing the artifact so it can be verified end-to-end. 
  • Hardened, source-built images such as Minimus typically remove 95% or more of CVE noise on day one, ship a signed Software Bill of Materials (SBOM), and rebuild continuously, so most hardening work shifts from manual configuration to platform-default behavior.
  • Vulnerability scanning is not hardening. Scanners report what is broken in production. Hardening prevents the same issues from reaching production in the first place, which is why CIS, NIST SP 800-190, and DISA STIG all treat minimization as a first-class control. 

What Is Container Hardening?

Container hardening (also called container image hardening) is the process of reducing a container's attack surface by removing unneeded software, dropping kernel privileges, restricting the filesystem and network, and verifying every artifact in the supply chain. It applies at three layers:

  • Image layer: select or build a minimal base image, remove shells, package managers, and build tools, pin every dependency to a digest, and ship a Software Bill of Materials (SBOM) with each version.
  • Runtime layer: run the container as a non-root user, drop Linux capabilities to the minimum required, mount the root filesystem read-only, and apply seccomp, AppArmor, or SELinux profiles.
  • Orchestration layer: enforce admission policies (Open Policy Agent (OPA), Kyverno) so non-compliant images and pod specs are rejected at deploy time, and require image signatures verified by Sigstore before admission.

A hardened container is one that fails closed. If an attacker reaches the workload, the workload contains nothing useful: no shell to spawn, no compiler to build a payload, no writable root filesystem to drop a file in, no privileged capability to abuse. Hardened image platforms, including Minimus, deliver this configuration as a default rather than a checklist.

Why Container Hardening Matters in 2026

The attack surface of a containerized application now extends past application code into the open source packages, base images, and CI/CD systems used to build and ship it. The threat model is no longer hypothetical:

  • Log4Shell (CVE-2021-44228), December 2021. Remote code execution in Apache Log4j 2.0-beta9 through 2.14.1, Common Vulnerability Scoring System (CVSS) v3 base score 10.0. The Cybersecurity and Infrastructure Security Agency (CISA) added it to the Known Exploited Vulnerabilities (KEV) catalog on December 10, 2021. Many affected teams could not answer "do we ship Log4j, and in which images?" That is the question an SBOM resolves.
  • SolarWinds Orion (SUNBURST), December 2020. Attackers backdoored the Orion build pipeline (CVE-2020-10148). The trojanized binary was signed and distributed to roughly 18,000 customers per CISA Alert AA20-352A. The compromise targeted the build system, not the source code.
  • XZ Utils backdoor (CVE-2024-3094), March 2024. A multi-year campaign inserted a backdoor into upstream xz-utils 5.6.0 and 5.6.1, briefly shipped in beta channels of several Linux distributions before discovery. The compromise lived in a transitive dependency of a system library that almost every container image inherits.

Regulators have responded. NIST Special Publication 800-190 defines container-specific controls, including image minimization and least privilege. The DoD's DevSecOps Enterprise Container Hardening Guide v1.2 lays out the federal baseline that Iron Bank-accredited vendors ship against. U.S. Executive Order 14028 and OMB Memorandum M-22-18 require federal vendors to provide SBOMs. FedRAMP Rev. 5 mandates continuous monitoring of software components. The Center for Internet Security (CIS) publishes Docker and Kubernetes Benchmarks that explicitly require non-root containers, dropped capabilities, and read-only filesystems.

What We See When Auditing Container Hardening Efforts 

Most container hardening efforts we audit fail in the same way: the team picks the right controls on paper, then loses them to operational drag.

A typical engagement looks like this. The base image is ubuntu:latest or node:20. The Dockerfile starts with a 30-line apt-get install block to add tools the application does not need at runtime but the build did. The container runs as root because somebody added a chown step early on and never came back to fix it. The Kubernetes admission policy is in audit mode, has been in audit mode for nine months, and the dashboard nobody opens shows 4,000 violations per week.

What changes the picture, in our experience, is replacing the input. A minimal, source-built base image with no shell, no package manager, and a signed SBOM removes most of the controls a team would otherwise have to apply by hand. The container is non-root because there is no root account configured. The filesystem is effectively read-only because there is nothing useful to write. The capability set is empty because the image never asked for any. That is the hardening posture Minimus ships by default, and it is why the rest of this guide reads more like a "what to verify" checklist than a "what to build" project plan.

Core Container Hardening Methods 

Five techniques do most of the work. They map directly to CIS Docker Benchmark v1.7 sections 4–5, CIS Kubernetes Benchmark v1.10 section 5, and the OWASP Docker Security Cheat Sheet.

Minimize the Base Image and Dependencies

Fewer packages mean fewer CVEs and a smaller blast radius if a vulnerability is exploited. A standard debian:12 image carries 50 to 60 Trivy findings before any application code is added; switching to a minimal or distroless base typically cuts that by an order of magnitude.

  • Distroless images ship only the application runtime - no shell, no package manager, no apt, no bash. Google's gcr.io/distroless/* images are the canonical example.
  • Source-built minimal images go a step further: every binary is rebuilt from upstream source against a hardened toolchain, with cryptographically verified provenance.

In every case, pin the base image to a digest (@sha256:...), not a floating tag. nginx:latest will mean something different next week.

Drop Linux Capabilities and Run as Non-Root

By default, a Docker container inherits a set of Linux capabilities (CAP_NET_RAW, CAP_CHOWN, CAP_SYS_PTRACE, and others) that almost no application needs. Drop them at the container level:

securityContext:
  runAsNonRoot: true
  runAsUser: 65532
  capabilities:
    drop: ["ALL"]
  allowPrivilegeEscalation: false

This is CIS Kubernetes Benchmark rule 5.2.6 (allowPrivilegeEscalation: false) and rule 5.2.5 (no privileged containers). User-namespace mapping in containerd 1.7+ further isolates the container's UID 0 from the host's UID 0.

Make the Root Filesystem Read-Only

Set readOnlyRootFilesystem: true and mount writable paths as named, size-limited volumes. An attacker who lands code execution inside the container loses the ability to drop a binary on disk, edit /etc/passwd, or persist anything past container restart. Combine with seccomp default profiles to block uncommon syscalls.

Sign Images and Track Provenance

Cryptographic signing closes the supply chain gap between the build system and the cluster. The standard stack:

  • Sigstore cosign signs images and SBOMs using short-lived OIDC-derived keys (no private key management required).
  • Fulcio issues code-signing certificates tied to the build identity (GitHub Actions OIDC token, for example).
  • Rekor records every signature in an append-only transparency log so tampering is detectable.
  • Supply-chain Levels for Software Artifacts (SLSA) v1.0 Build L3 defines the provenance requirements—isolated build, source-controlled definition, signed attestation.

A hardened image platform produces these artifacts as part of the build, not as a retrofit. Minimus ships a CycloneDX and SPDX SBOM signed with Sigstore for every image version, plus SLSA Build L3-aligned provenance.

Eliminate Embedded Secrets

A hardened image with a hard-coded API token in /app/config/.env is not hardened. Three rules:

  • Never bake secrets into the image. Use external secret managers (HashiCorp Vault, AWS Secrets Manager, Kubernetes Secrets backed by an external KMS).
  • Inject at runtime. Mount secrets as environment variables or tmpfs volumes, never as committed files.
  • Scan before push. Run TruffleHog or GitHub secret scanning in CI to catch leaks before they reach the registry.

GitGuardian's 2024 State of Secrets Sprawl report counted 12.8 million new secrets exposed in public GitHub commits during 2023, up 28% year over year.

Container Hardening Best Practices Checklist 

The following checklist consolidates the controls above into something a platform team can hand to engineering. Each row maps to a recognized benchmark.

Control Standard Action
Minimal base image, pinned to digest CIS Docker 4.1 Use distroless or source-built base; replace :latest with @sha256:...
Run as non-root CIS Docker 4.1, CIS K8s 5.2.6 Set runAsNonRoot: true, runAsUser ≥ 1000
Drop all Linux capabilities CIS Docker 5.3 capabilities.drop: ["ALL"], add back only what is required
Read-only root filesystem CIS K8s 5.2.4 readOnlyRootFilesystem: true plus tmpfs for writable paths
No privileged containers CIS K8s 5.2.5 Reject privileged: true at admission with Kyverno or OPA
Signed images with provenance SLSA Build L3 Cosign-sign every image; verify at admission
SBOM published per version NIST SP 800-190, EO 14028 Generate CycloneDX or SPDX with Syft or Trivy at build
VEX data attached CISA SBOM/VEX guidance Publish Vulnerability Exploitability eXchange (VEX) for non-exploitable findings
Resource limits set CIS K8s 5.7 requests and limits for CPU and memory
Continuous rebuilds NIST SP 800-190 §4.4 Rebuild on upstream CVE disclosure within 48 hours for criticals

Why Vulnerability Scanning Alone Is Not Container Hardening

Vulnerability scanning is a detective control. It tells you what is broken after the image is built and, in most pipelines, after it has been pushed to production. Hardening is a preventive control. It changes the input so the scanner has less to find.

The practical limitations of scanning-as-hardening:

  • Alert fatigue. A standard public image returns 50 to 60 Trivy findings, 15 to 20 rated High or Critical, even when the application uses a fraction of those packages. Most are noise the team learns to ignore.
  • Patch lag. Even when a CVE is real, the patch lives upstream. Teams wait days or weeks for a base-image rebuild.
  • No provenance. A scanner cannot tell you whether the binary inside the image is the binary the source repository compiled. SLSA provenance and Sigstore signatures can.
  • No configuration coverage. A scanner does not know whether the container runs as root or whether the filesystem is writable. Those are admission-policy questions.

A complete container security program runs scanners (Trivy, Grype, or Clair) in CI and in the registry, but treats the scanner output as a backstop for the hardening work, not as the work itself.

How to Operationalize Container Hardening in CI/CD 

Hardening that lives only in a wiki page does not survive contact with a release deadline. Five integration points keep the practice in the pipeline:

  1. Build step. Replace FROM ubuntu:22.04 with a minimal or hardened base image pinned to a digest. Run a multi-stage build so build-only tools do not ship in the final image.
  2. SBOM and signing step. Generate an SBOM with Syft (or use the platform's signed SBOM) and sign the image and SBOM with Sigstore cosign before push. GitHub Actions, Tekton, GitLab CI, and Jenkins all support this in a few lines of YAML.
  3. Registry admission. Configure the registry (Harbor, JFrog Artifactory, Google Artifact Registry) to reject images without a valid signature and SBOM.
  4. Cluster admission. Deploy Kyverno or OPA Gatekeeper to verify signatures, block privileged pods, and enforce non-root and read-only filesystem. Start in audit mode, move to enforce mode after the audit log is clean.
  5. Runtime monitoring. Run Falco or Tetragon on the cluster to detect what slips past the previous four layers. Treat their alerts as exceptions, not the primary signal.

Per the GitLab 2024 Global DevSecOps Report, 67% of developers said workflow disruption is the top reason they bypass security tooling. A hardening pipeline that adds 30 seconds to a build and ships a signed, minimal image will hold. One that adds 10 minutes and a manual approval will not.

Where Minimus Fits in a Container Hardening Program 

Minimus is a hardened, minimal container image platform. It addresses the most expensive part of a hardening program: producing and maintaining minimal, source-built, signed base images that stay current with upstream CVEs without a team of release engineers behind them.

Each Minimus image is built from upstream source against a hardened toolchain, ships with a cryptographically signed CycloneDX and SPDX SBOM, and is rebuilt continuously so newly disclosed CVEs in included packages are remediated under a 48-hour Service Level Agreement (SLA) for critical findings. Replacing a standard public base image with a Minimus equivalent typically removes 95% or more of the CVE noise on day one—the methodology is documented in how Minimus backs the 95% fewer CVEs claim.

Minimus is image- and supply-chain-centric, not a Cloud-Native Application Protection Platform (CNAPP). It pairs with Falco, Tetragon, or Sysdig for runtime detection, with Kyverno or OPA for admission policy, and with Trivy or Grype for ongoing scanning of any non-Minimus images still in use. For federal teams, Minimus images are available on Iron Bank and align with the DoD DevSecOps Container Hardening Guide; for control mapping see how Minimus supports NIST SP 800-190 container security compliance.

Peer hardened image platforms in the same category include Chainguard Images and Docker Hardened Images (DHI). The category-level argument for source-built minimal images is the same in all three cases. The differences are in image catalog scope, rebuild SLA, compliance positioning (FIPS 140-3, STIG, FedRAMP, Iron Bank), and pricing.

Conclusion 

Container hardening is not a single product or a one-time project. It is a build-time discipline backed by admission policy and verified by runtime detection. The base image is the decision that decides everything else.

Standard public images ship with 50 to 60 CVEs, full shells, and root by default, and turn every other control into a triage queue. Minimal, source-built, signed images ship with a fraction of that count, no shell, and a non-root user, and make every layer above them cheaper to operate. Treat hardened image platforms as the prevention layer, run scanners and runtime detection as backstops, and a platform team can keep the program maintained instead of fighting it.

Frequently Asked Questions 

What Is Container Hardening?

Container hardening is the practice of reducing a container's attack surface by removing unneeded software, dropping Linux capabilities, locking down the filesystem and network, and signing images so they can be verified end-to-end. It applies at the image, runtime, and orchestration layers and aligns with controls in CIS Docker, CIS Kubernetes, NIST SP 800-190, and DISA STIG benchmarks.

How Do You Harden a Container Image?

Start with a minimal, source-built base image pinned to a digest, such as a distroless image or a hardened image from a platform like Minimus. Run the container as a non-root user, drop all Linux capabilities and add back only what is required, set readOnlyRootFilesystem: true, eliminate embedded secrets, and sign the image and its SBOM with Sigstore cosign. Enforce all of the above at admission with Kyverno or OPA Gatekeeper.

What Is the Difference Between Container Hardening and Vulnerability Scanning?

Container hardening is preventive. It changes what goes into an image so that fewer vulnerabilities exist in the first place and so that a breached container has limited capability. Vulnerability scanning is detective. It reports CVEs in an image after the image is built. Scanning catches what hardening missed; it does not replace hardening.

Are Hardened Container Images a Substitute for Runtime Security?

No. Hardened images reduce the input. Runtime tools such as Falco, Tetragon, and Sysdig watch what running containers actually do. A complete program uses hardened images as the prevention layer, admission policy as the gatekeeper, and runtime detection as the backstop for what slips past both.

Is Container Hardening the Same as Patching?

No. Patching applies a fix to a known vulnerability after it is disclosed. Container hardening reduces the surface area where vulnerabilities can exist in the first place by removing unneeded packages, dropping kernel privileges, and locking the runtime configuration. A hardened image still needs patching when CVEs land in the packages it does include, but it has far fewer packages to patch and a shorter remediation window. Platforms like Minimus close the loop by rebuilding hardened images automatically when upstream patches ship, with a 48-hour SLA for critical CVEs.

What Standards and Benchmarks Govern Container Hardening?

The Center for Internet Security (CIS) publishes Docker and Kubernetes benchmarks that define non-root, dropped-capability, and read-only-filesystem controls. NIST Special Publication 800-190 defines container-specific controls including image minimization and least privilege. The DoD DevSecOps Enterprise Container Hardening Guide v1.2 and DISA STIG profiles cover federal hardening requirements; Iron Bank serves as the accredited delivery channel for compliant images. SLSA Build L3 defines the provenance bar for the build system itself. Hardened image platforms such as Minimus align to all four out of the box. 

Minimus
Minimus
Sign up for minimus

Avoid over 97% of container CVEs

Access hundreds of hardened images, secure Helm charts, the Minimus custom image builder, and more.