---
title: "Chasing CVEs: Lessons from a real container build using Red Hat Hardened Images"
description: "Rebuilding the Pi-hole container (shell, compiled C FTL, and JavaScript) on Red Hat Hardened Images' minimal core-runtime surfaced several practical lessons for distroless-style builds."
url: "https://swe.quest/articles/chasing-cves-lessons-from-a-real-container-build-using-red-hat-hardened-images-62d3a11e8fc21490"
canonical: "https://developers.redhat.com/articles/2026/11/24/lessons-from-a-real-container-build-with-red-hat-hardened-images"
source: "Red Hat Developer"
published: "2026-11-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["containers","supply-chain-security","ci-cd","linux"]
---

# Chasing CVEs: Lessons from a real container build using Red Hat Hardened Images

A post on [Red Hat Developer](https://swe.quest/sources/red-hat-developers.md), published 2026-11-24, 8 min read, Case study. Original: [https://developers.redhat.com/articles/2026/11/24/lessons-from-a-real-container-build-with-red-hat-hardened-images](https://developers.redhat.com/articles/2026/11/24/lessons-from-a-real-container-build-with-red-hat-hardened-images)

## Summary

Rebuilding the Pi-hole container (shell, compiled C FTL, and JavaScript) on Red Hat Hardened Images' minimal core-runtime surfaced several practical lessons for distroless-style builds. Installing RPMs into a separate installroot and copying it over duplicates packages and overwrites the rpmdb, so scanners see something very different from the base. Using RUN --mount to bind the core-runtime builder image and run its dnf against the final stage keeps the rpmdb accurate, so grype matches added packages to CVE feeds correctly. Other lessons: create Busybox symlinks at build time rather than patching scripts, use a small sidecar container to inspect packages, track upstream releases, base images and individually added RPMs with Renovate, and add functional tests for the DNS pod.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [Supply chain security](https://swe.quest/tags/supply-chain-security.md) (Security)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Linux](https://swe.quest/tags/linux.md) (Infrastructure)

## Prerequisites

- Containerfile/Dockerfile basics
- multi-stage builds
- RPM and dnf

## Keywords

Red Hat Hardened Images, Pi-hole, dnf, Renovate, Busybox, grype, Podman, rpmdb

## Related posts

- [From Security Blocked to Prod Ready: ClickHouse on Docker Hardened Images](https://swe.quest/articles/from-security-blocked-to-prod-ready-clickhouse-on-docker-hardened-images-fbdddd6267212370.md): Docker · 2026-04-30 · Medium · 11 min read · Containers, Supply chain security, Kubernetes, Security
  Security scanners block the standard ClickHouse image because its Ubuntu 22.04 base ships unused packages carrying unpatched CVEs, such as wget (CVE-2021-31879) and tar.
- [Secure by Design: A Proactive Testing Approach with Testcontainers, Docker Scout, and Hardened Images](https://swe.quest/articles/secure-by-design-a-proactive-testing-approach-with-testcontainers-docker-scout-3bd5cb7e139bb4be.md): Docker · 2025-08-28 · Medium · 10 min read · Containers, Supply chain security, Testing, TypeScript
  Swapping a Node.js API's node:22-slim base image for a Docker Hardened Image (distroless dhi-node:22) eliminated all critical and high CVEs flagged by Docker Scout, including Debian 12's CVE-2025-6020, while avoiding the musl compatibility risk of switching to Alpine.
- [Making the Most of Your Docker Hardened Images Enterprise Trial – Part 1](https://swe.quest/articles/making-the-most-of-your-docker-hardened-images-enterprise-trial-part-1-61a4db14eac1477b.md): Docker · 2025-11-14 · Medium · 10 min read · Containers, Supply chain security, Security
  Docker Hardened Images (DHI) strip base images down to the minimum runtime, removing package managers, shells and utilities while keeping distro compatibility.
- [The Supply Chain Paradox: When “Hardened” Images Become a Vendor Lock-in Trap](https://swe.quest/articles/the-supply-chain-paradox-when-hardened-images-become-a-vendor-lock-in-trap-081399f78d0156a6.md): Docker · 2025-08-20 · Easy · 7 min read · Supply chain security, Containers
  Pre-hardened container images reduce attack surface but can create a subtle vendor lock-in.
- [Hardened Images Explained: Fewer CVEs, Smaller Attack Surface](https://swe.quest/articles/hardened-images-explained-fewer-cves-smaller-attack-surface-84ba4f604fd33924.md): Docker · 2026-06-04 · Easy · 8 min read · Supply chain security, Containers, Security
  Most container CVEs come from unused packages in general-purpose base images (often 400+ packages when an app needs 20–30), not application code.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
