Bird
0
0

If a Dockerfile has multiple RUN commands installing packages separately, what is the likely effect on image size?

medium📝 Command Output Q5 of 15
Docker - Image Optimization
If a Dockerfile has multiple RUN commands installing packages separately, what is the likely effect on image size?
AImage size is smaller because each RUN is isolated
BImage size decreases because layers are merged automatically
CImage size stays the same regardless of RUN commands
DImage size increases due to multiple layers with redundant data
Step-by-Step Solution
Solution:
  1. Step 1: Understand Docker layering

    Each RUN creates a new layer; redundant data in layers increases size.
  2. Step 2: Recognize impact of multiple RUN commands

    Multiple RUN commands without combining increase image size unnecessarily.
  3. Final Answer:

    Image size increases due to multiple layers with redundant data -> Option D
  4. Quick Check:

    Multiple RUN commands = Larger image size [OK]
Quick Trick: Combine RUN commands to reduce layers and image size [OK]
Common Mistakes:
  • Assuming layers merge automatically
  • Thinking multiple RUN commands reduce size

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes