We run a small internal tool a custom MCP server, the kind of thing more teams are now standing up to give AI agents access to internal systems like GitHub or Slack. It runs as a container, same as everything else. We hadn’t scrutinized its base image the way we would a customer-facing service, mostly because it never occurred to us that it needed the same level of attention. So we migrated it from a standard base image to a hardened one and measured what actually changed, rather than assuming the usual advice about “minimal images” applied here the way it does everywhere else.
How we measured it
Both builds used the same application source and declared dependencies (package.json, src/); the runtime base changed from Debian-based Node (node:24-trixie-slim) to Alpine-based Docker Hardened Images (dhi.io/node:24-alpine3.23), built via a multi-stage Dockerfile with a -dev variant for the build stage. Both images were scanned with Docker Scout on September 28, 2026, on the same architecture (linux/amd64). Because the distribution changed along with the image provider, treat the numbers below as a comparison of these two specific builds, not an isolated measurement of what hardening alone contributes some of the difference reflects Alpine’s smaller footprint relative to Debian, independent of the hardening effort itself.
This is a single migration of a single tool, not a controlled study across image types treat it as one documented data point, not a general verdict on any vendor's product.
Everything needed to reproduce this is public in the hardened-mcp-server repository: the MCP server source, both Dockerfiles, and the GitHub Actions workflow that builds, smoke-tests and scans each image. The numbers below come from one CI run on September 28, 2026.
Standard base image | Hardened base image | |
|---|---|---|
Image size (Docker Scout) | 104 MB | 56 MB |
Packages | 376 | 132 |
Vulnerabilities reported by Docker Scout, Sept 28, 2026 | 36 (0 Critical / 6 High / 6 Medium / 24 Low) | 0 |
Zero vulnerabilities reported by Docker Scout on this date – not “provably free of vulnerabilities”. A scan is a snapshot against a known-CVE database at a point in time, not a guarantee about what hasn’t been disclosed yet.
Note: Docker Scout’s size report for the standard image is 104 MB but plain docker images lists it as 255 MB. For the hardened image, Docker Scout lists it as 56 MB but plain docker images lists it as 135 MB. The gap is expected: docker images shows the uncompressed size on local disk, while Docker Scout reports the compressed size.
The Dockerfile change
The hardened build is a two-stage Dockerfile. The -dev tag includes a shell and npm, so dependencies are installed there. The runtime stage uses the plain tag, which has no shell, and only receives the files the server needs to run.
# Build stage: -dev tag has a shell and toolchain FROM dhi.io/node:24-alpine3.23-dev AS build WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY src/ ./src/ # Runtime stage: no shell, only the built artifacts FROM dhi.io/node:24-alpine3.23 WORKDIR /app COPY --from=build --chown=node:node /app/node_modules ./node_modules COPY --from=build --chown=node:node /app/src ./src COPY --from=build --chown=node:node /app/package.json ./package.json ENV PORT=3000 EXPOSE 3000 USER node CMD ["node", "src/server.js"] Pulling from dhi.io needs a free Docker ID and a one-time docker login dhi.io. DHI tags change on Docker’s own schedule, so check the DHI catalog for current tags before copying these.
What actually disappeared
The package-count reduction did not mostly consist of obscure OS packages. Instead many of the removed packages were from the npm toolchain itself, e.g. @npmcli/arborist, pacote, npm-registry-fetch, etc. These packages are part of the standard Node.js image but the MCP server never runs npm in production, only node src/server.js. Thus they represent attack surface for code that never runs anyway, and a hardened base image removes them as a side effect of its minimal nature.
The rest was the Debian userland the server never touches at runtime: bash, systemd, login/passwd/shadow, pam, sysvinit, apt and dpkg.
Plan for debugging without a shell in production
Hardened runtime images are typically shipped without a shell but every major option here also ships a debug or development variant precisely so you're not left without one when you need it: distroless publishes :debug tags with a busybox shell, Chainguard offers :latest-dev tags with a full toolchain, and Docker Hardened Images has -dev variants we used exactly this variant for our own build stage, because Docker's RUN instruction executes through a shell by default and the build stage needs to run npm ci. The practical takeaway isn't "accept no shell, ever" it's choosing a minimal variant for the production runtime and deliberately planning a separate debugging path in advance, rather than assuming the shell you're used to having will still be there when something breaks.
For Docker Hardened Images specifically, Docker Debug attaches a debugging toolkit to a running container without adding a shell to the image itself, so docker exec -it <container> sh failing is no longer a dead end.
The broader landscape, briefly
Google’s distroless images are built on top of Debian and are automatically updated to the latest Debian packages via pull requests to the distroless repository. Chainguard builds packages from source on top of its own distribution, Wolfi, and builds images daily with pinned versions of packages. Hardened versions of Docker images are built on top of the Debian or Alpine Linux distributions and are free and Apache 2.0 licensed as of the end of 2025. This means that, depending on your existing toolchain, the compliance requirements of your organization, and how much effort you are willing to invest in migrating, there is a hardened image provider that can fit your needs.
Why this is worth doing now
The container that needed hardening used to be almost always customer-facing. Increasingly, it's internal tooling too MCP servers, agent bridges, anything giving an AI system reach into company systems. Those containers carry real credentials and real API access, and in our own experience, this class of internal tooling hasn't gotten the same scanning rigor as public-facing services. That's the actual gap this exercise closed for us: not a security guarantee, but a measurable, documented reduction in attack surface for one of these newer, less-scrutinized internal services.