What Changed When I Hardened an Internal MCP Server Image
For years, “use a minimal base image” has been standard security advice that most teams nod at and don’t quite quantify. That’s changed. A growing set of hardened-image options — Google’s distroless project, Chainguard Images and Docker’s now-free-and-open-source Hardened Images — all make the same underlying claim: your standard base image ships far more than your application needs, and that surplus is measurable, not theoretical.
I tested this directly, not by reading vendor claims, but by migrating a real internal tool and scanning both versions.
Three Paths, Three Trade-Offs
- Distroless (Google) is the oldest and most established of the three — Kubernetes, Knative and Tekton all use distroless images. It’s free and strictly minimal: no shell, no package manager in standard runtime images. The trade-off is patch cadence — updates depend on upstream package availability and image rebuilds, so there can be a gap between a CVE being disclosed and a patched image becoming available.
- Chainguard builds packages from source using Wolfi and Chainguard OS and rebuilds its images daily. That aggressiveness is the appeal, but the free tier offers only
latestandlatest-devtags — version-specific tags and SLA-backed remediation require a paid subscription. - Docker Hardened Images are built on familiar Debian or Alpine foundations, which can lower migration friction for teams already using those distributions. The core hardened images became free and Apache 2.0 licensed at the end of 2025.
None of these is strictly “the right one” — which fits depends on how much migration effort you can absorb, whether you need contractual patch SLAs, and how tightly your compliance posture requires supply-chain provenance.
The Worked Example
I took a small internal tool — a custom Model Context Protocol (MCP) server, the kind of thing more teams are now running to give AI agents access to internal systems — and rebuilt it on a hardened base instead of a standard one. The numbers below are pulled from a real CI run, not estimated:
The more interesting finding wasn’t the CVE count — it was what got removed. A big chunk of the difference wasn’t obscure OS packages; it was the npm CLI’s own internal toolchain — dependency-resolution and publishing tooling that ships inside a standard Node.js image by default, even though a running server never invokes npm itself. That’s attack surface sitting in the image for code that’s never executed, and it’s the kind of thing a hardened base removes automatically that a manual package-removal pass would likely miss.
The Trade-Off That’s Common to All Three Approaches
Whichever minimal runtime base you pick, you typically give up the same thing: a shell. No bash, no apk/apt — fewer built-in tools for an attacker to leverage if the container is ever compromised. That’s the point, but it also means the usual “exec into the container and poke around” debugging habit stops working.
Two consequences follow, regardless of vendor:
- Multi-stage builds become particularly important. Without a package manager in the final image, dependencies can be installed in a separate stage with a full toolchain, then copied into the minimal runtime stage as plain files.
- Debugging habits have to change. Each of these ecosystems has its own answer — dedicated debug images, development variants or tools that provide debugging capabilities on demand. The mechanism differs by vendor, but the underlying shift is similar: debugging tooling moves from “always present, just in case” to being available when needed.
Deciding Which One Fits
A rough framework, independent of which vendor you evaluate first:
- If you’re already running Kubernetes-ecosystem tooling and want zero cost, distroless is a reasonable default.
- If your compliance posture demands provenance guarantees and you can justify a subscription, Chainguard’s daily-rebuild model is an attractive option.
- If your team wants the security improvement without also absorbing a distribution change, a hardened option based on your existing distribution can lower the migration cost.
Why This Matters More Now Than It Did Two Years Ago
The container that needed hardening used to be almost always customer-facing — the API server, the web app. Increasingly, it’s internal tooling too: MCP servers, internal agent bridges, anything that gives an AI system reach into company systems. Those containers carry real credentials and real API access, and until recently, most teams weren’t scanning them with the same rigor as a public-facing service. That’s the gap hardened base images are actually closing — not just shrinking a number on a security dashboard, but reducing the attack surface if one of these newer, less-scrutinized internal services is ever compromised.
About the Author
Sangharsh Agarwal is a Senior Site Reliability Engineer at Adobe, published in USENIX ;login: and DZone, and a technical reviewer for “SRE with AIOps” (BPB Publications).



