Courseiva
hardMultiple ChoiceObjective-mapped

CAS-004 Practice Question: A security audit reveals that Docker containers…

A security audit reveals that Docker containers are built with multiple unnecessary layers and utilities. Which practice reduces the attack surface of the container image?

⚠ Common exam trap

The CAS-004 exam often tests the misconception that reducing image size (via multi-stage builds or cache deletion) is equivalent to reducing attack surface, but the real security improvement comes from removing unnecessary software, not just shrinking the image.

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 a base image with only the required packages

Using a base image with only the required packages directly reduces the attack surface by eliminating unnecessary binaries, libraries, and services that could contain vulnerabilities. This practice aligns with the principle of minimalism in container security, where every extra package increases the potential for exploitation. Unlike multi-stage builds or RUN command consolidation, this approach targets the root cause: the contents of the image itself.

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 multi-stage builds

    Why it's wrong here

    Multi-stage builds help reduce final image size but not necessarily base image packages.

  • Use a base image with only the required packages

    Why this is correct

    Minimizing installed packages reduces the attack surface.

  • Combine multiple RUN commands into one

    Why it's wrong here

    Combining RUN statements reduces layers but not the packages installed.

  • Delete the apt cache in the Dockerfile

    Why it's wrong here

    Deleting cache reduces image size but does not remove unnecessary utilities.

About these practice questions

Courseiva writes every CAS-005 question from scratch — 968 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 CAS-005 practice question is part of Courseiva's free CompTIA 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 CAS-005 exam.