Bird
0
0

Given this Dockerfile snippet for a Spring Boot app:

medium📝 component behavior Q13 of 15
Spring Boot - Docker and Deployment
Given this Dockerfile snippet for a Spring Boot app:
FROM openjdk:17-jdk-slim
COPY target/app.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]

What happens when you run this container?
AThe Spring Boot app starts inside the container using Java 17.
BThe container will fail because the ENTRYPOINT syntax is wrong.
CThe app.jar file is deleted after copying.
DThe container runs but does not start the app.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze Dockerfile commands

    The base image provides Java 17. The app.jar is copied into the container. ENTRYPOINT runs the jar with Java.
  2. Step 2: Understand container behavior on run

    Running the container executes the ENTRYPOINT command, starting the Spring Boot app inside.
  3. Final Answer:

    The Spring Boot app starts inside the container using Java 17. -> Option A
  4. Quick Check:

    ENTRYPOINT runs app.jar with Java [OK]
Quick Trick: ENTRYPOINT runs the app inside container [OK]
Common Mistakes:
  • Thinking ENTRYPOINT syntax is invalid
  • Assuming files are deleted after COPY
  • Believing container runs without starting app

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes