Courseiva
Container Image BuildingmediumMultiple ChoiceObjective-mapped

EX188 Container Image Building Practice Question

A developer needs to optimize image size by removing build caches and temporary package manager cache files within the same RUN instruction. Why must this be done in a single RUN instruction?

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

Because file deletions in separate layers do not reduce the final image size due to the layered filesystem.

Docker/Podman image layers are read-only snapshots. Deleting a file in a later layer only hides it; it does not remove it from previous layers.

Answer analysis

Option-by-option breakdown

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

  • Because file deletions in separate layers do not reduce the final image size due to the layered filesystem.

    Why this is correct

    Layers are additive; removing files in a subsequent layer just adds a whiteout file, leaving previous layers intact.

  • Because package managers lock the database across different layers.

    Why it's wrong here

    Package managers do not maintain locks across independent layer creation.

  • Because the container build engine will fail if cache cleanup happens in a separate layer.

    Why it's wrong here

    The build will not fail, but the image size will not decrease.

  • To ensure environment variables persist between installation and cleanup.

    Why it's wrong here

    Environment variables persist via ENV, not layer consolidation.

About these practice questions

One of 296 original EX188 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Red Hat exam blueprint

This EX188 practice question is part of Courseiva's free Red Hat 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 EX188 exam.