easyMultiple ChoiceObjective-mapped
200-901 Practice Question: Refer to the exhibit
Exhibit
FROM python:3.9-slim WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt COPY . . EXPOSE 5000 CMD ["python", "app.py"]
Refer to the exhibit. The Docker image built from this Dockerfile is larger than expected. Which optimization should be recommended?
⚠ Common exam trap
Cisco often tests the misconception that reducing the number of layers (Option B) or using a smaller base image (Option A) is the primary way to shrink image size, when in fact multi-stage builds are the correct, targeted solution for removing build-time artifacts that inflate the final 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 multi-stage build.
Multi-stage builds allow you to use multiple FROM statements in your Dockerfile. You can compile or install dependencies in an intermediate stage using a full-featured base image, then copy only the necessary artifacts (e.g., compiled code, libraries) into a final, minimal runtime image. This dramatically reduces the final image size by discarding build tools, temporary files, and unnecessary layers from the earlier stages.
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 a smaller base image like python:3.9-alpine.
Why it's wrong here
This is a valid optimization but not the most recommended for this simple case; multi-stage build is more comprehensive.
- ✗
Combine RUN and COPY layers to reduce layers.
Why it's wrong here
This reduces layers but not the actual size; cache inefficiency may increase build time.
- ✗
Remove the EXPOSE instruction.
Why it's wrong here
EXPOSE is metadata and does not affect image size.
- ✓
Use a multi-stage build.
Why this is correct
Multi-stage builds allow copying only necessary artifacts, significantly reducing the final image size.
Go deeper
Related to this question
About these practice questions
One of 989 original 200-901 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.