Bird
0
0

You want to add a config file to a scratch-based container but keep the image minimal. Which approach is best?

hard📝 Application Q9 of 15
Docker - Image Optimization
You want to add a config file to a scratch-based container but keep the image minimal. Which approach is best?
AMount the config file as a volume at runtime
BInstall a package manager and download the config at runtime
CUse a base image like Alpine instead of scratch
DCOPY the config file directly into the scratch image
Step-by-Step Solution
Solution:
  1. Step 1: Consider scratch limitations

    Scratch is empty and minimal, so adding files increases image size.
  2. Step 2: Evaluate options for minimal size

    Mounting the config as a volume keeps the image small and allows config changes without rebuilding.
  3. Final Answer:

    Mount the config file as a volume at runtime -> Option A
  4. Quick Check:

    Use volumes to keep scratch images minimal [OK]
Quick Trick: Mount configs as volumes to keep scratch images small [OK]
Common Mistakes:
  • Copying files increases image size
  • Installing package managers defeats scratch minimalism

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes