Docker Image Inspection: Read an Image Before You Pull It
Last updated:
Docker image inspection is reading a published image’s registry manifest and configuration blob — its user, ports, entrypoint, environment variable names and every layer’s size and build line — before you download a single layer. Everything in this article comes from two small JSON documents the registry will hand to anyone who asks politely, and the Public Docker Image Inspector reads them live for any public Docker Hub image. For the file that built the image, see the Dockerfile Auditor; for the packages inside it, the SBOM Vulnerability Scanner.
What you can learn before pulling
A registry is not a black box. Before a single layer moves, it will tell an anonymous caller the image’s full table of contents: the manifest lists the config blob and every layer digest with its compressed size, and a manifest list (an OCI index) lists the per-platform builds one tag carries. Two small JSON documents — usually a few kilobytes — answer most of the questions people otherwise learn by pulling hundreds of megabytes.
That makes inspection the cheapest step in a supply-chain review. Size, age, architecture coverage and the build’s own history are all visible up front, and anything that looks wrong — a two-year-old base, a 400 MB layer, a tag that moved since yesterday — can stop a pull before it starts. The registry API is public and documented; the only reason inspection feels like a trick is that the Docker CLI folds it into docker pull and docker inspect and never shows the middle.
Reading a config blob: the supply-chain surface
The config blob is the image’s contract with its runner. User tells you whether the process runs as root — an empty User means root, still the single most common finding on public images. ExposedPorts is the publisher’s declaration of what the container listens on; Entrypoint and Cmd are the exact argv that executes when nobody overrides them; WorkingDir and the label set round out how the image expects to be used.
Read as an attacker would, that is the supply-chain surface in one screen: a root process, a surprising port, an entrypoint that downloads something at start time. Read as an operator, it is the difference between a deployment that works and an afternoon of guessing. None of it requires running the image — the config is data the publisher shipped, available to anyone, which is exactly why reading it first is free security review.
Layer archaeology: created_by lines and where the weight is
Every layer in the manifest pairs with a history entry in the config, and the history’s created_by lines are the build’s diary: the Dockerfile instructions, in order, that produced the image — the base it started from, the package installs, the copies, the step where someone ran a 300 MB download into a layer that never got cleaned. Sizes attach to steps, so the archaeology is quantitative: the layer table shows which instruction carries the weight.
This is also where hygiene failures fossilise. A created_by line can preserve commands the publisher would not write in a README — build-time flags, internal URLs, the occasional credential passed as a build argument in an old build. You cannot unship a layer, but you can decide in a minute whether an image’s history is one you want running in production.
The env-name trap in published images
Image configs carry the environment the publisher baked in, as NAME=value pairs. The names alone are a finding: variables called API_TOKEN, DATABASE_PASSWORD or AWS_SECRET_ACCESS_KEY in a published image mean the publisher’s runtime expects secrets to arrive by environment — fine — but they also invite the question of whether a real value got baked into a public build by mistake, which has happened often enough to be a genre of breach write-up.
The honest way to surface this is names only. Our inspector’s checker strips every Env entry to its variable name plus a count before anything leaves the server, because a value is data nobody needs to render a warning — and because fetching values “to check” would make the checker itself the leak. A flagged name is a prompt to verify with the publisher, never proof: only the value would prove it, and the value is precisely what a careful tool refuses to touch.
Pinning by digest vs tag
A tag is a pointer that a publisher can move; a digest is the content address of one exact manifest. nginx:alpine today and nginx:alpine next month are routinely different bytes — usually a rebuilt base, occasionally something worse — while nginx@sha256:… is the same manifest forever, because the digest is computed from the content. Inspection makes the distinction concrete: the report shows the digest your tag resolves to right now.
Pinning by digest is the reproducible end of that observation. Production references pinned to a digest cannot drift under you; the cost is that updates become deliberate, which is the point. A reasonable middle ground is to deploy by digest and review by tag: inspect the tag, note the digest it resolves to, pin that. The inspection report gives you both halves of that workflow in one screen.
Limits of an inspection — and the family it belongs to
Inspection reads metadata, not contents. It cannot tell you whether a binary inside a layer is backdoored, whether a package carries a CVE, or whether the image behaves at runtime — sizes are compressed registry sizes, the config is what the publisher claims, and a different platform build of the same tag can differ in every field. Treat an inspection as the first screen, not the verdict.
The rest of the family covers the other screens: the Dockerfile Auditor reviews the build recipe itself, and the SBOM Vulnerability Scanner inventories the packages inside an image you have pulled. Inspection, recipe, inventory — three cheap reads that, together, answer most of what “should we run this image?” is really asking. Run the inspection live with the Public Docker Image Inspector.
The manifest, trimmed
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:1a2b…(config blob)",
"size": 9526
},
"layers": [
{ "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:3c4d…", "size": 29146797 },
{ "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:5e6f…", "size": 1048576 }
]
}