How to Migrate to Hardened Base Images Without Breaking Builds
Migrating to hardened base images is mostly a Dockerfile change, but the effort depends on one decision: whether the new images are drop-in replacements for what you run today or a different distribution.
Step 1: Inventory your base images
List every distinct base image in your registries and Dockerfiles, with its tag and the number of services that use it. Most fleets are dominated by a handful: a few Python, Node.js and Java runtimes, nginx, and a couple of databases or brokers. Those are the first targets, because each swap removes CVEs from many services at once. Wiz, Snyk and similar tools can map vulnerabilities to the base layer to help prioritize.
Step 2: Decide drop-in or re-base
| Drop-in replacement | Re-base onto a new distribution | |
|---|---|---|
| Example | Echo, RapidFort, Docker Hardened Images | Chainguard (Wolfi), WizOS (Alpine-compatible), CleanStart |
| Dockerfile change | The FROM line | FROM line, package manager commands, sometimes the user and paths |
| Typical blocker | Rare | Shell-less images, apk vs apt, glibc vs musl |
| Pilot time | Hours | Days per image family |
Step 3: Pilot on one service
Pick a service with good test coverage that uses one of your most common bases. Change the FROM line, rebuild, run the tests and scan the result. With a drop-in provider such as Echo, this is the whole migration for most services. Record the CVE count before and after, which becomes the business case for the rest of the fleet.
Step 4: Handle the build stage
Minimal runtime images often have no shell or package manager. Use multi-stage builds: compile and install dependencies in a builder image that has the tools, then copy the result into the minimal runtime image. Most hardened image vendors publish a development variant for the builder stage.
Step 5: Do not forget the libraries
A clean base image does not stay clean once npm install or pip install runs on top of it. Point your package managers at a hardened library source, such as Echo Libraries or Chainguard Libraries, or mirror it into Artifactory or Nexus. See the rankings for hardened npm packages and hardened Python libraries.
Step 6: Roll out and lock in
- Mirror the hardened images into your own registry and pin by digest.
- Let a bot such as Renovate open pull requests when the vendor publishes a new digest.
- Add an admission policy that allows only images from the hardened source.
- Track the CVE count per service in your scanner to prove the result.
Common mistakes
- Swapping images without pinning digests, so builds drift.
- Hardening application images but leaving Helm chart images, operators and sidecars on upstream.
- Treating the migration as one-off. The value comes from the vendor maintaining the image afterward.