Bird
0
0

What will be the result of this Dockerfile snippet regarding image size?

medium📝 Command Output Q5 of 15
Docker - Image Optimization
What will be the result of this Dockerfile snippet regarding image size?
FROM ubuntu
RUN apt-get update && apt-get install -y python3
RUN rm -rf /var/lib/apt/lists/*
AImage size is reduced by cleaning apt lists after install
BImage size remains large due to separate RUN commands
CImage size increases because apt-get update is not cleaned
DImage size is minimal because python3 is installed
Step-by-Step Solution
Solution:
  1. Step 1: Identify cache cleanup

    Removing '/var/lib/apt/lists/*' deletes apt cache files after install.
  2. Step 2: Effect on image size

    This cleanup reduces image size by removing unnecessary files.
  3. Final Answer:

    Cleaning apt lists after install reduces image size. -> Option A
  4. Quick Check:

    Cache cleanup reduces size = Image size is reduced by cleaning apt lists after install [OK]
Quick Trick: Clean apt cache after install to reduce image size [OK]
Common Mistakes:
  • Not cleaning cache
  • Assuming separate RUN commands always increase size
  • Ignoring cleanup effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes