Bird
0
0

You built a Docker image for your Spring Boot app but when running the container, it exits immediately. Which is the most likely cause?

medium📝 Debug Q14 of 15
Spring Boot - Docker and Deployment
You built a Docker image for your Spring Boot app but when running the container, it exits immediately. Which is the most likely cause?
AThe app.jar file is too large to run in a container.
BThe ENTRYPOINT command is missing or incorrect, so the app never starts.
CThe Dockerfile uses FROM openjdk:8 instead of 17.
DDocker does not support Spring Boot apps.
Step-by-Step Solution
Solution:
  1. Step 1: Understand container exit behavior

    Containers exit immediately if no running process is specified or if the process ends quickly.
  2. Step 2: Identify cause related to ENTRYPOINT

    If ENTRYPOINT is missing or wrong, the container has no command to keep running, so it exits.
  3. Final Answer:

    The ENTRYPOINT command is missing or incorrect, so the app never starts. -> Option B
  4. Quick Check:

    Missing ENTRYPOINT = container exits immediately [OK]
Quick Trick: Always set ENTRYPOINT to start your app [OK]
Common Mistakes:
  • Blaming Java version mismatch for immediate exit
  • Thinking file size causes container exit
  • Believing Docker can't run Spring Boot apps

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes