Bird
0
0

This Dockerfile fails to build:

medium📝 Troubleshoot Q7 of 15
Docker - Image Optimization
This Dockerfile fails to build:
FROM scratch
RUN apk add curl

Why does this error occur?
AThe RUN command syntax is incorrect
BScratch image has no package manager to run RUN commands
Capk is not installed but RUN works
DScratch image does not allow any commands
Step-by-Step Solution
Solution:
  1. Step 1: Understand scratch limitations

    Scratch is empty and has no shell or package manager, so RUN commands cannot execute.
  2. Step 2: Analyze the error cause

    Trying to run 'apk add curl' fails because apk does not exist in scratch.
  3. Final Answer:

    Scratch image has no package manager to run RUN commands -> Option B
  4. Quick Check:

    Scratch cannot run RUN commands needing tools [OK]
Quick Trick: Scratch has no shell or package manager [OK]
Common Mistakes:
  • Thinking RUN commands work in scratch
  • Assuming apk is available in scratch

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes