Skip to content

Introduction to DHI

- views
Cover image

Containers have become the core of modern application delivery. But as adoption grows, so does the attack surface. From vulnerable base images to supply chain risks, security is no longer optional—it’s foundational.

This is where docker-hardened-imagesDocker Hardened Images (DHI) come into play.

Docker Hardened Images are minimal, secure, and production-ready container images maintained directly by Docker. They are designed to reduce vulnerabilities from the start while simplifying compliance and integration into existing workflows. Docker Hardened Images features

Instead of relying on generic base images and fixing issues later with scanners, DHI focuses on building a secure foundation from the beginning.

TL;DR

  • Secure, minimal, production-ready container images by Docker
  • Near-zero CVEs with continuous patching
  • Built-in SBOM, provenance (SLSA L3), and signed metadata
  • Drop-in replacement for existing Docker workflow
  • Available in Community, Select, and Enterprise tiers

What is DHI?

Docker Hardened Images (DHI) are curated container images built with a strong focus on security, minimalism, and maintainability. They are designed to reduce the number of known vulnerabilities by limiting unnecessary packages and continuously applying patches.

Why does it matter?

Most container vulnerabilities originate from base images. If your foundation is already risky, everything built on top inherits that risk. DHI minimizes this exposure early in the lifecycle.

When should you use it?

  • When building production-grade applications
  • When compliance and security are priorities
  • When you want to reduce dependency on reactive scanning

How does it work?

DHI combines multiple security layers:

Security by Default

  • Near-zero known vulnerabilities (CVEs)
  • Non-root containers by default
  • Minimal packages → smaller attack surface

Full Transparency

  • Signed SBOM (Software Bill of Materials)
  • SLSA Level 3 build provenance
  • VEX (context about exploitability)
  • Cryptographic signatures for integrity

Hardened Supply Chain

  • Packages built from source by Docker
  • Signed and verified artifacts
  • Reduced risk from compromised public registries

Developer Friendly

  • Built on Alpine and Debian, requiring minimal changes to adopt. Full support glibc and musl available in both variants for broad application compatibility
  • Compatible with existing CI/CD
  • No major workflow changes required

How to Get Started?

Using DHI doesn’t require additional software installation because it’s integrated directly into the Docker Engine. However, since it uses a specialized registry, you must first authenticate.

1. Authenticate to the DHI Registry

Open your terminal and run the login command for the official dhi.io registry:

Terminal window
docker login dhi.io

You will be prompted for your Docker ID and Personal Access Token (PAT). Ensure your account has access to a Docker tier that supports DHI (Select or Enterprise tiers).

2. Update your Dockerfile

Implementation is as simple as updating a single line in your Dockerfile. Just replace your standard image prefix with dhi.io/.

Example: Standard Node.js Image

FROM node:22-alpine
# ... rest of your build

Example: Hardened Node.js Image

FROM dhi.io/node:22
# ... rest of your build

Best Practices: Implementation Strategies

Since DHI images are designed to be extremely minimal—often lacking a shell (like /bin/sh) or a package manager (like apt/apk)—you should adopt the following strategies:

Adopt Multi-Stage Builds

DHI is a runtime-optimized image, not a build-time environment. Perform your compilation and dependency installation in a standard “builder” image, then copy only the necessary artifacts into the final DHI layer.

# Stage 1: Build (Standard Image)
FROM node:22 AS builder
WORKDIR /app
COPY . .
RUN npm install && npm run build
# Stage 2: Runtime (Hardened Image)
FROM dhi.io/node:22
WORKDIR /app
COPY --from=builder /app/dist ./dist
# DHI runs as a non-root user by default
CMD ["node", "dist/index.js"]

Deep Debugging with “docker debug”

Because DHI images lack an interactive shell, docker exec -it will not work by default. Instead, use the new Docker Debug capability to inspect your running containers:

Terminal window
docker debug <container_id>

Conclusion

docker-hardened-imagesDHI represents a shift in how we think about container security.

Instead of reacting to vulnerabilities after scanning, DHI helps prevent them from being introduced in the first place—starting from the base image.

It doesn’t replace tools like Trivy or other scanners, but it significantly reduces the noise and risk those tools have to deal with.

If you’re already building containers, adopting hardened images is one of the lowest-effort, highest-impact improvements you can make.

Aight, thanks for taking the time read this post. Happy containerazation 🚀

References: