Skip to content

Docker audit fixes

Image Vulnerabilities: fixing all 8 checks

The image audit inspects the images already pulled onto this host - their CVEs, embedded secrets, default user, base image age and signing - because a container is never safer than what was baked in.

Six of the eight checks ask the daemon for the local image list, so they report "Cannot query Docker daemon - run as root, with sudo, or as a docker group member" rather than a pass, and they skip a second way when the host has no local images at all. Image Signature Verification and SBOM Generation only look for binaries on PATH, so they still answer when the daemon is unreachable.

CtrlOpsImage Vulnerabilities audit8 CHECKS
Checks in this audit
8
Rated high severity
3
Need root or sudo
6
Automated run time
~16s

Transcribed from the docker-security-image-vulnerabilities audit script. For what the audit covers rather than how to fix it, see the Image Vulnerabilities checklist, or how the CtrlOps Security Audit runs.

Every check

Find your finding

Listed in the order the audit runs them. Take the check name from the third field of the result line and open its page.

  1. 01Image Vulnerability ScanScans local Docker images for known CVEs using trivy (or reports if no scanner is available)Severity: HIGHNeeds rootCan return FAIL · WARN · SKIP · PASS
  2. 02Floating Image TagsFlags images using the floating :latest tag instead of a pinned version/digestSeverity: MEDIUMNeeds rootCan return WARN · SKIP · PASS
  3. 03Image Secrets ScanScans image layers/build history for embedded credentials and secretsSeverity: HIGHNeeds rootCan return FAIL · WARN · SKIP · PASS
  4. 04Image Default UserChecks whether images define a non-root USERSeverity: MEDIUMNeeds rootCan return WARN · SKIP · PASS
  5. 05Image Signature VerificationChecks whether Docker Content Trust or cosign-based signature verification is in placeSeverity: MEDIUMNo root neededCan return WARN · SKIP · PASS
  6. 06End-of-Life Base ImageFlags known end-of-life or soon-to-be-EOL base image tagsSeverity: HIGHNeeds rootCan return FAIL · SKIP · PASS
  7. 07Image Build Best PracticesRuns dockle if available, otherwise heuristically checks for HEALTHCHECK presenceSeverity: LOWNeeds rootCan return WARN · SKIP · PASS
  8. 08SBOM GenerationChecks whether an SBOM generator (syft, docker sbom, trivy) is availableSeverity: LOWNo root neededCan return WARN · PASS

Shared script behaviour

How the Image Vulnerabilities audit reads your server

Every check in this audit runs after the same preamble, and several of its results only make sense once you know what that preamble could and could not see.

The preamble

Most examine the first 5 or 10 local images (docker images | head -N), so large hosts are sampled, not fully scanned.

Docker detection: DOCK=direct if docker ps works as the audit user (docker group), DOCK=root if it works through sudo; the dk helper wraps docker accordingly. IDS is the list of running container IDs and NRUN their count; dk inspect --format is used with Go templates. Podman is recognised but not audited.

Why checks skip

A SKIP is never a pass

A skipped check verified nothing at all. The most common cause is privilege: 6 of the 8 checks in this audit need root for a complete result. Before every run, each script works out which of four privilege modes it is in.

rootThe audit runs as UID 0.Every privileged branch runs directly. No check skips for lack of permission.
nopasssudo -n true succeeds, so the account has passwordless sudo.Privileged commands run through sudo -n.
passA sudo password was supplied in the CtrlOps audit settings and accepted.Privileged commands run through sudo -S.
noneSKIPNone of the above worked.CAN_ROOT=0. Every privileged branch returns SKIP with a "Need root" message rather than guessing.

If many checks skip with a “need root” message, run the audit as root, grant the audit account sudo (with or without NOPASSWD), or supply the sudo password in the CtrlOps audit settings. For Docker checks, membership of the docker group is an alternative to sudo: run usermod -aG docker <user> and log in again.

Keep going

FAQ

Image Vulnerabilities questions

Can't find your answer? Join Discord

  • That SKIP means trivy returned nothing inside the script's 120 second per-image timeout, and the usual cause is a first run: trivy downloads a vulnerability database of tens of megabytes before it can scan anything. Run trivy image --download-db-only once to warm the cache, then re-run the audit. On an air-gapped host, point TRIVY_DB_REPOSITORY at a mirror instead.

  • No, most of these checks read a sample. The CVE scan, the floating tag check and the secrets scan take the first 5 images from docker images; the default USER check and the HEALTHCHECK heuristic take the first 10, and dockle takes the first 3. Only the end-of-life base image check reads the whole list. On a host with thirty images, a PASS says the sample was clean, not that the host is.

  • Because this check has drifted, and its own page says so. It reads exactly two things: the DOCKER_CONTENT_TRUST variable in the audit's own shell, and whether a cosign binary is on PATH. It never inspects an image or a signature. Docker retired Content Trust and withdrew notary.docker.io, so DOCKER_CONTENT_TRUST=1 now breaks pulls of Docker Official Images: treat that PASS as a finding of its own, unset the variable, and verify with cosign instead.

Stop juggling tools. Start managing fleets.

PuTTY
Termius
MobaXterm
WinSCP
SecureCRT
Royal TS
Warp
CtrlOps14 tools left
Webmin
aaPanel
RunCloud
Dokploy
IP spreadsheet
bash (2)
sticky notes

One app. All your servers. No context switching. Free to start, free to leave.

Start instantly · No credit card · Cancel anytime

Your privacy preferences. We use product analytics to improve CtrlOps. Google Analytics cookies and live chat stay off until you allow them. Cookie policy