Courseiva
Supply Chain SecurityeasyMultiple ChoiceObjective-mapped

CKS Supply Chain Security Practice Question

Which of the following is a best practice for securing container images?

⚠ Common exam trap

A common trap in the CKS exam is the belief that using the 'latest' tag for base images is safe because it provides the newest security patches. However, 'latest' is mutable and can introduce breaking changes or vulnerabilities without version pinning, violating supply chain security best practices.

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

Use distroless base images to minimize the attack surface

Distroless base images contain only the application and its runtime dependencies, omitting package managers, shells, and other utilities that could be exploited. This dramatically reduces the attack surface and aligns with the principle of least functionality, making it a best practice for securing container images in Kubernetes environments.

Answer analysis

Option-by-option breakdown

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

  • Run containers as root to ensure all permissions are available

    Why it's wrong here

    Running as root inside a container maps to the root user on the host when privilege escalation is not explicitly restricted; combined with the default capabilities (e.g., CAP_DAC_OVERRIDE, CAP_SYS_ADMIN), a compromised root process could leverage a kernel vulnerability to break out of the container and gain host-level access. The principle of least privilege demands that containers run as an unprivileged user (via USER directive), with capabilities dropped and root filesystem mounted read-only, to limit the blast radius of any intrusion.

  • Use the 'latest' tag for base images to get the latest features

    Why it's wrong here

    The 'latest' tag is a mutable pointer that changes without warning, so a build that works today may pull a different base image tomorrow, introducing unexpected library changes or newly discovered vulnerabilities while breaking the reproducibility required for secure supply chain management. Pinning to a specific image digest (e.g., imagename@sha256:...) or a versioned tag with a digest ensures the exact same filesystem content is used across all builds and environments, allowing thorough security scanning and controlled updates rather than surprise changes.

  • Use distroless base images to minimize the attack surface

    Why this is correct

    Distroless base images contain only the minimal runtime libraries and timezone data necessary to execute the application, with no shell, package manager, or other utilities that an attacker could use for post-exploitation; this dramatically reduces the attack surface because many privilege-escalation and lateral-movement techniques rely on tools like curl, wget, or a shell that are simply absent. However, this also means debugging directly inside the container is harder, so distroless images should be paired with robust structured logging and centralized observability to maintain visibility without sacrificing a minimal, hardened runtime footprint.

  • Embed secrets directly in the Dockerfile for easy access

    Why it's wrong here

    Embedding secrets in a Dockerfile, whether through ENV, ARG, or COPY, places them in permanent image layers and the image README/metadata; anyone who can pull or inspect the image can extract those secrets using 'docker history' or 'docker save', and they may also be leaked indirectly through registry push logs or CI build logs. Secrets must instead be injected at runtime from secure external sources—such as Kubernetes Secrets, Docker secrets, or a vault service—and referenced in the container environment, ensuring the secret never persists in the image artifacts themselves.

About these practice questions

This CKS question is part of Courseiva's 114-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.