Courseiva
Supply Chain Security →easyMultiple Choice

CKS Supply Chain Security Practice Question

A security engineer wants to scan a container image for vulnerabilities using Trivy. Which command should they use?

⚠ Common exam trap

The exam often tests the distinction between Trivy's subcommands (`image` vs `repo` vs `fs`), where candidates mistakenly use `trivy scan` (which does not exist) or confuse `trivy repo` (for Git repos) with container image scanning.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

trivy image <image-name>

Trivy uses the `image` subcommand to scan a container image for vulnerabilities. The correct syntax is `trivy image <image-name>`, which pulls the image (if not already present) and scans its layers against known vulnerability databases (e.g., NVD, Red Hat, Debian). This is the standard command for container image scanning in Trivy.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    trivy image <image-name>

    Why this is correct

    `trivy image <image-name>` targets the container image artefact directly, pulling and unpacking its layers to inspect OS packages and language dependencies for known CVEs. This satisfies the stem's requirement to scan an image, unlike filesystem or repository scans, which analyse different targets.

  • ✗

    trivy scan <image-name>

    Why it's wrong here

    Trivy's subcommand for image scanning is 'image', not 'scan'; 'trivy scan' is not a valid command, so it fails immediately. It is tempting because 'scan' describes the intent, and other tools use it, but Trivy reserves that word for nothing — 'trivy image <image-name>' is the correct syntax.

  • ✗

    trivy repo <image-name>

    Why it's wrong here

    `trivy repo` scans remote Git repositories for dependency and misconfiguration issues, not container images. It fails here because the stem requires image-layer vulnerability scanning, which `trivy image` performs. It is tempting when auditing source code repositories directly, where scanning a Git URL for vulnerable dependencies would be the correct choice.

  • ✗

    trivy fs <image-name>

    Why it's wrong here

    trivy fs scans a filesystem path for vulnerabilities and misconfigurations in lockfiles and dependencies; it does not pull and inspect a container image. trivy image is the subcommand that downloads the image and scans its layers and OS packages.

About these practice questions

One of 845 original CKS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.