Lesson 17 of 30
A clean image today doesn't stay clean — every base image and package it's built from accumulates newly-disclosed CVEs over time, with zero code changes on your side, which is why scanning is a schedule, not a one-time gate.
10 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
An image passed a clean security scan when it was built and pushed six months ago, and has never been rebuilt since. Is it still guaranteed free of known critical vulnerabilities today?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
An image scanner (Trivy, Grype, Docker Scout, or a cloud registry's built-in scanner like ECR's) inspects an image's layers and produces a list of every OS package and language dependency it contains, then cross-references that list against public vulnerability databases (the CVE — Common Vulnerabilities and Exposures — feed and similar sources). The output is a report: which packages have known, disclosed vulnerabilities, and how severe each one is.
The most common way this gets used is as a CI gate: a build step runs the scan and fails the pipeline if anything at or above a chosen severity threshold (critical, or critical + high) turns up. This catches a real, common category of risk before it ever reaches production — a base image with an outdated OpenSSL, a language dependency with a known remote-code-execution bug — without requiring anyone to manually track disclosures themselves.
The part that's easy to miss: a scan result is a snapshot of the vulnerability databases at the moment the scan ran, not a permanent property of the image. An image that passed a clean scan on Monday can fail the identical scan on Friday, with the exact same bytes, the exact same layers, zero code changes — because a new CVE affecting one of its packages got disclosed on Wednesday. The image didn't get worse. The world's knowledge of it did.
trivy image --severity CRITICAL,HIGH --exit-code 1 myapp:latest
--exit-code 1 is what turns this from an informational report into an actual gate — a nonzero exit fails the CI job, blocking the build from being pushed or deployed. This is the same shape as any other CI quality gate (tests, lint, type-check): a command that either passes silently or fails loudly enough to stop the pipeline.
"How do you make sure known vulnerabilities don't reach production?" is a standard security-process question, and the strong answer covers both halves: a CI gate on push (catching new vulnerabilities in new code), and scheduled re-scanning of what's already deployed (catching newly-disclosed vulnerabilities in code that hasn't changed at all). Naming only the first half is the most common gap — it sounds complete but leaves every already-deployed image permanently unmonitored.