Sub topic 4
Getting started with Docker Scout
This chapter introduces Docker Scout and its quickview command. It assumes you can pull, build and run images, work comfortably in a terminal, and know what a Dockerfile and a software dependency are. It also assumes you have read the earlier chapters on image contents, CVEs and SBOMs.
What Docker Scout does
Docker Scout is an image analysis service built into the Docker CLI. It reads the package inventory of an image (its SBOM), compares each package against advisory data, and reports which known vulnerabilities apply. Because it works from the inventory, it can analyze an image without running it.
Scout has four commands that you will use across the next chapters:
| Command | Purpose |
|---|---|
| `docker scout quickview` | Summary of vulnerability counts by severity |
| `docker scout cves` | Full list of individual vulnerabilities |
| `docker scout recommendations` | Suggested base image updates or alternatives |
| `docker scout compare` | Differences between two image versions |
This chapter covers quickview. The others follow in order.
Before you start
You need a recent Docker Desktop or the Docker Scout CLI plugin, and you need to be signed in to Docker Hub. Check the plugin and sign in:
docker scout version
docker loginIf docker scout is not recognized, update Docker Desktop or install the Scout plugin for your platform. Scout analyzes images from your local Docker image store or from a registry, so you can scan an image before or after you push it.
Running a quick view
Run quickview against an image name:
docker scout quickview nginx:latestIf the image is not stored locally, Scout fetches its metadata from the registry. The output is a short report. It shows the target image with a count of vulnerabilities grouped by severity: critical, high, medium and low. It also shows the base image Scout detected, with its own counts, and may suggest an update for that base image.
Read the output in this order:
- Find the line for the target image and check the critical and high counts.
- Look at the base image counts. If most vulnerabilities also appear there, they come from the base, not from your own layers.
- Note whether Scout suggests a base image refresh. You will act on this in a later chapter.
How the pieces fit together
When you run a command, Scout builds or retrieves the image's package inventory. It then matches those packages against its advisory database and returns the result.
The advisory database changes daily. Running the same command on the same image a week later can give different counts, because new CVEs are published and fixes are released. The image has not changed. Only the data it is matched against has.
Common problems
- Authentication errors. Scout needs a Docker login. Run
docker loginagain if commands fail with an access error. - No base image shown. Scout detects the base from image provenance and layer data. Images built without that information may show no base image or no update suggestion.
- Surprising zero counts. An image with no recognized packages, such as one built from
scratch, can show no vulnerabilities. This means nothing was found to match. It does not prove the image is safe, because a statically linked binary may contain vulnerable libraries that the inventory does not list. - Stale local copies. If you scan a local tag that you pulled long ago, you scan the old content. Pull again first when you want the current image.
Try it yourself
- Pull
nginx:latestand rundocker scout quickview nginx:latest. - Write down the critical and high counts for the image and for its base.
- Repeat the command with a slim variant such as
nginx:alpineand compare the totals.
Exercise
You run docker scout quickview on an image on Monday and again the following Monday. The image tag was not pushed again, but the counts differ. What explains this?
Show answer
The advisory data that Scout matches against changes over time. New CVEs are published and fixes are released, so the same package inventory can match a different set of vulnerabilities. The image itself did not change.
Exercise
The quickview output shows many high vulnerabilities for your image, and nearly the same number for its base image. Where should you look first to reduce them?
Show answer
Look at the base image. Most of the findings come from it, so updating to a newer base image or switching to a smaller one is the most direct fix, rather than changing your own layers.