Red HatMatt MiceneTutorial
Chasing CVEs: Lessons from a real container build using Red Hat Hardened Images
Summary
After Red Hat Hardened Images launched, the author migrated a Pi-hole DNS sink container to the core-runtime image, aiming for the smallest starting footprint for a dynamically linked application. Multi-stage builds separated the build stage, which used the core-runtime:builder image with dnf, from the final stage that only received application files and runtime dependencies like Bash. The RUN –mount type=bind option mounted the builder image at /builder and ran dnf from that path, correctly updating the rpmdb in the final stage without the package duplication that occurs with the installroot pattern. Busybox symlinks required manual creation because Red Hat’s packaging does not create them; the author initially used explicit calls but later created all symlinks at build time to simplify maintenance. Renovatebot tracked upstream Pi-hole releases, the core-runtime base image, and added RPMs like Busybox, automatically creating pull requests for updates.
Context
The post describes the author’s experience migrating a Pi-hole DNS sink container to Red Hat Hardened Images, focusing on minimizing the runtime footprint and automating updates. The migration involved converting an Alpine-based container to use the core-runtime image, addressing packaging differences, and setting up continuous dependency tracking.
Approach / What changed
The author used multi-stage builds with a builder stage containing dnf, and a final stage based on core-runtime. They used RUN –mount type=bind to mount the builder image and run dnf from that path to install RPMs directly into the final stage, updating the rpmdb correctly. Busybox symlinks were created manually at build time. Renovatebot was configured to track upstream GitHub releases, the core-runtime base image, and added RPMs, generating pull requests for updates. Testing verified DNS functionality.
Takeaways
Multi-stage builds with RUN –mount allow installing RPMs into a minimal base image while correctly updating the rpmdb, avoiding package duplication from the installroot pattern.
Busybox symlinks may need manual creation when switching from Alpine to Red Hat Hardened Images because Red Hat’s packaging does not create them automatically.
Renovatebot can track upstream GitHub releases, container base images, and added RPMs to automate container updates, generating pull requests for review.
FAQ
How do you install RPMs in a minimal base image without dnf?
Use the RUN --mount type=bind option in a Containerfile to mount a builder image that contains dnf, then run dnf from that mounted path. This installs packages into the final stage and correctly updates the rpmdb without duplicating packages.
Why did Busybox symlinks need manual creation?
Red Hat's Busybox package does not create symlinks like Alpine's does. The author initially used explicit calls to busybox functions but later created all symlinks at build time with a single line in the Containerfile to simplify maintenance.
How do you automate updates for a container built from multiple sources?
Use Renovatebot with datasources for GitHub releases, container images, and RPMs. Configure it to track the upstream Pi-hole releases, the core-runtime base image, and any added RPMs like Busybox. Renovatebot will create pull requests for detected updates.
Source and freshness
- Source
- developers.redhat.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.