Sub topic 4
Getting started with Docker Scout
Docker Scout is Docker's image analysis tool. It builds an inventory of the packages in an image and matches that inventory against vulnerability advisory data. This chapter covers what Scout does, how to get it running, and how to read the first report it gives you: docker scout quickview.
Prerequisites
This chapter assumes you can:
- Pull, build, and run images with Docker.
- Read a Dockerfile and know what a base image is.
- Use a terminal and a Docker Hub account (or can create one).
- Recognize the terms CVE and severity from the previous chapter, "CVEs, severity and fixed versions".
What Docker Scout does
Scout answers three questions about an image:
- What is in it? Scout reads the image layers and produces a Software Bill of Materials (SBOM), a list of operating system packages and language dependencies.
- Which known vulnerabilities affect those packages? Scout compares the SBOM with advisory data it keeps and updates continuously.
- What can you do about it? Scout points to base image updates and lets you compare versions.
Scout reaches you through several surfaces: the docker scout CLI, Docker Desktop, Docker Hub, and the Docker Scout dashboard. This tutorial uses the CLI, because commands can be scripted and run in CI.
Installing and signing in
Docker Desktop includes the Scout CLI plugin. Check that it is available:
docker scout versionOn Docker Engine without Desktop, for example on a Linux server or a CI runner, you need to install the plugin separately. The Docker Scout documentation provides an install script and release binaries for the docker-scout plugin. Once the plugin sits in a Docker CLI plugin directory, docker scout works as above.
Sign in to Docker Hub before you scan:
docker loginScout uses your Docker identity to access analysis features. The set of features and the number of repositories you can enable depend on your Docker subscription. Check your plan if a command reports that a feature is not available for your organization.
Your first scan: quickview
docker scout quickview prints a short summary. It is the right first command because it shows overall risk before you read individual CVEs.
docker scout quickview nginx:latestIf you build an image locally and run docker scout quickview without an argument, Scout analyzes the most recently built image.
The output has the same shape as the following sketch. Your numbers and names will differ, because they depend on the image and the date you scan it.
Target: nginx:latest
digest: <image digest>
vulnerabilities: 1C 4H 12M 60L 2?
size: <image size>
packages: <package count>
Base image: debian:bookworm-slim
vulnerabilities: 0C 0H 3M 25L
What's next:
View vulnerabilities → docker scout cves nginx:latest
View base image update recommendations → docker scout recommendations nginx:latestRead it in three parts.
The target block
The target block describes the image you asked about. The digest identifies the exact content, which matters because a tag such as latest can point to different images over time. The vulnerability line gives counts by severity, written as letters:
| Letter | Severity |
|---|---|
| C | Critical |
| H | High |
| M | Medium |
| L | Low |
| ? | Unspecified, no severity rating available |
The unspecified count is not zero risk. It means the advisory sources have not assigned a rating, and you should look at those findings individually.
The base image block
Scout tries to detect the base image your image was built on and reports its vulnerabilities separately. Comparing the two lines tells you where the findings come from. If the base image has the same counts as your image, your own layers add little. The fix is then usually a newer or smaller base image. If your image has many more findings than the base, your own packages and dependencies are the cause.
Base image detection relies on provenance information stored with the image. It may be missing or approximate for images that were built without it, or that were flattened or rebuilt from scratch.
The what's next block
Scout ends with the commands that follow naturally. The cves command lists every finding (next chapter). The recommendations command suggests base image changes (covered later in this tutorial).
Choosing where Scout reads the image from
An image reference can name an image in different places. Scout accepts prefixes that make the source explicit:
# An image in the local Docker image store
docker scout quickview local://myapp:1.0
# An image in a registry, without pulling it first
docker scout quickview registry://nginx:latest
# An image saved as an OCI layout directory
docker scout quickview oci-dir://./image-export
# A local directory of source files
docker scout quickview fs://.Without a prefix, Scout uses the local image if one exists and otherwise reads it from the registry. The prefixes remove that ambiguity, which matters in CI where a stale local copy can hide a newer registry image.
Why the same image shows different results over time
The advisory data Scout uses changes every day, even though your image does not. A scan of an unchanged image can show new findings tomorrow, because a CVE can be published after the image was built. A finding can also disappear when an advisory is corrected or a distribution backports a fix.
For that reason, a clean scan is a statement about one moment, not a permanent guarantee. Scan in CI on every build, and rescan images you have already published.
Scanning an image you built
A short working example shows the loop you will use in practice. Create a Dockerfile:
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir requests==2.25.0
COPY app.py .
CMD ["python", "app.py"]Create a trivial app.py:
import requests
print(requests.get("https://example.com", timeout=10).status_code)Build the image and scan it:
docker build -t myapp:1.0 .
docker scout quickview local://myapp:1.0The pinned requests==2.25.0 is an old release, chosen so that the scan has a Python dependency to report. In the quick view, the package count includes both the operating system packages from the Debian-based base image and the Python packages you installed with pip. The base image block reports on the python:3.12-slim portion, so the difference between the two blocks reflects the requests layer and its dependencies.
Keep this image. Later chapters use myapp:1.0 with docker scout compare, after you change the dependency and build a myapp:2.0.
Common problems
- The command is not found. Docker has no
scoutplugin. Rundocker scout versionto check, then install the plugin if you are not on Docker Desktop. - Authentication or feature errors. Run
docker loginand confirm your account or organization has Scout enabled for the feature you used. - No base image shown. Scout could not determine the base image. This often happens with images built without provenance data, so build with a recent BuildKit-based
docker build. - Results differ from another scanner. This is expected, and a later chapter explains why. Both tools can be right when they use different advisory sources and package matching rules.
- An old tag gives no new data. Check the digest. You may be looking at a cached local copy, so use
registry://to scan what the registry currently serves.
Summary of the quick view workflow
- Sign in with
docker login. - Run
docker scout quickview <image>and note the digest and severity counts. - Compare the target line with the base image line to see where the vulnerabilities come from.
- Follow up with
docker scout cvesfor details ordocker scout recommendationsfor base image changes.
Exercise
You run docker scout quickview local://myapp:1.0. The target line shows 0C 3H 10M 40L and the base image line shows 0C 3H 9M 38L. Where do most of the findings come from, and which command would you run next to see the individual CVEs?
Show answer
Nearly all findings come from the base image, since its counts almost match the target's. Your own layers add only about one medium and two low findings. Run docker scout cves local://myapp:1.0 to list the individual CVEs. To address the base image, run docker scout recommendations local://myapp:1.0 to look for a newer or slimmer base.
Exercise
A colleague scans nginx:latest on Monday and sees no critical findings. On Friday you scan the same tag and see one. Name two possible reasons, and say how you would tell them apart.
Show answer
One reason is that the tag now points to a different image, for example after a rebuild. The other is that a new CVE was published against a package that was already in the old image. Compare the digests in the target block. If the digests differ, the image changed. If they match, the image is identical and the advisory data changed.