Bird
0
0

What is a common practice to reduce Docker image size related to layers?

easy📝 Conceptual Q2 of 15
Docker - Image Optimization
What is a common practice to reduce Docker image size related to layers?
AUse multiple FROM statements for each step
BCombine multiple RUN commands into one
CAdd unnecessary files to increase caching
DAvoid cleaning package caches
Step-by-Step Solution
Solution:
  1. Step 1: Understand Docker layers

    Each RUN command creates a new layer, increasing image size.
  2. Step 2: Combine commands

    Combining multiple commands into one RUN reduces layers and image size.
  3. Final Answer:

    Combining RUN commands reduces layers and image size. -> Option B
  4. Quick Check:

    Fewer layers = smaller image [OK]
Quick Trick: Combine RUN commands to reduce layers and size [OK]
Common Mistakes:
  • Using many RUN commands
  • Not cleaning caches
  • Adding extra files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes