Question 672 of 997
Supply Chain SecuritymediumMultiple ChoiceObjective-mapped

Best Dockerfile Change to Address Critical CVEs in Container Images

This CKS practice question tests your understanding of supply chain security. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A DevOps engineer runs 'trivy image myapp:latest' and finds a critical CVE in the base image. Which Dockerfile change would BEST address this?

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

Switch to a distroless base image with a SHA digest

Switching to a distroless base image with a SHA digest (e.g., gcr.io/distroless/base@sha256:...) eliminates the vulnerable packages present in the original base image because distroless images contain only the minimal runtime dependencies (e.g., glibc, libssl) and no package manager or shell, drastically reducing the attack surface. Pinning the image by SHA digest ensures immutability and prevents the base image from being silently updated to a version that reintroduces the same or different vulnerabilities, which is critical for supply chain security.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Use an Alpine base image with the latest tag

    Why it's wrong here

    Alpine is minimal but 'latest' tag may change; still may contain CVEs.

  • Set USER root in the Dockerfile

    Why it's wrong here

    Running as root increases security risk, not reduces it.

  • Switch to a distroless base image with a SHA digest

    Why this is correct

    Distroless images are minimal and have fewer CVEs. Using SHA prevents unexpected changes.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Add a non-root user in the Dockerfile

    Why it's wrong here

    Improves security but does not address base image vulnerabilities.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The CKS exam often tests the misconception that simply using a smaller base image (like Alpine) or adding a non-root user is sufficient to fix a CVE, when in reality the vulnerability must be removed from the image entirely, and distroless with a SHA digest achieves that by eliminating the vulnerable components and pinning the image hash.

Detailed technical explanation

How to think about this question

Distroless images are built by Google and contain only the application and its runtime dependencies (e.g., libc, certificates) without a shell, package manager, or common utilities, which means many CVEs in OS-level packages (e.g., bash, curl) are irrelevant because those components are absent. Using a SHA digest (e.g., @sha256:abc123...) instead of a tag (e.g., :latest) ensures that the image is immutable and can be verified against a known good hash, preventing supply chain attacks where a tag is overwritten with a malicious or vulnerable version. In practice, this approach is recommended by the CIS Docker Benchmark and aligns with the principle of immutable infrastructure.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the CKS exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CKS practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CKS practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CKS question test?

Supply Chain Security — This question tests Supply Chain Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Switch to a distroless base image with a SHA digest — Switching to a distroless base image with a SHA digest (e.g., gcr.io/distroless/base@sha256:...) eliminates the vulnerable packages present in the original base image because distroless images contain only the minimal runtime dependencies (e.g., glibc, libssl) and no package manager or shell, drastically reducing the attack surface. Pinning the image by SHA digest ensures immutability and prevents the base image from being silently updated to a version that reintroduces the same or different vulnerabilities, which is critical for supply chain security.

What should I do if I get this CKS question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on CKS

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A developer runs 'trivy image myapp:latest' and gets a report with several CRITICAL CVEs. Which action would BEST address the supply chain security risk?

easy
  • A.Ignore the report because the container is running in a sandboxed environment
  • B.Run 'trivy image myapp:latest --severity CRITICAL' to filter out lower severity findings
  • C.Rebuild the image using a minimal base image like distroless or alpine with no CVEs
  • D.Add a network policy to block outbound traffic from the container

Why C: Option C is correct because rebuilding the image using a minimal base image like distroless or Alpine directly eliminates the vulnerable packages that cause the CRITICAL CVEs. This addresses the root cause of the supply chain risk by ensuring the container image contains only the necessary runtime dependencies, reducing the attack surface and removing known vulnerabilities at the source.

Variation 2. During a CI/CD pipeline, you run 'trivy image myapp:latest' and get a high number of vulnerabilities. What is the BEST action to reduce the vulnerability count?

medium
  • A.Increase CPU and memory limits for the container
  • B.Switch to a distroless base image
  • C.Sign the image with Cosign
  • D.Remove all environment variables from the Dockerfile

Why B: Distroless base images contain only the essential runtime dependencies (e.g., glibc, libssl) and exclude package managers, shells, and other utilities that are common sources of CVEs. By switching to a distroless image, you drastically reduce the attack surface and the number of packages that Trivy scans, directly lowering the vulnerability count without changing application code.

Keep practising

More CKS practice questions

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.