Bird
0
0

You wrote this Dockerfile using a distroless image:

medium📝 Troubleshoot Q14 of 15
Docker - Image Optimization
You wrote this Dockerfile using a distroless image:
FROM gcr.io/distroless/base
COPY app /app
CMD ["/app"]

But when you run the container, it exits immediately with no logs. What is the most likely cause?
AThe CMD syntax is incorrect for distroless images
BThe distroless image requires a shell to run commands
CThe container needs a package manager to start
DThe app binary is missing executable permissions
Step-by-Step Solution
Solution:
  1. Step 1: Check distroless image requirements

    Distroless images run the app binary directly without a shell or package manager.
  2. Step 2: Identify common cause of immediate exit

    If the app binary lacks executable permission, the container will exit immediately without running the app.
  3. Final Answer:

    The app binary is missing executable permissions -> Option D
  4. Quick Check:

    Missing exec permission = container exits immediately [OK]
Quick Trick: Check app permissions; distroless runs binary directly [OK]
Common Mistakes:
  • Thinking distroless needs a shell to run commands
  • Assuming CMD syntax differs for distroless
  • Believing package manager is required to start

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes