Bird
0
0

Which Dockerfile instruction is used to expose the port your Spring Boot application listens on?

easy📝 Conceptual Q2 of 15
Spring Boot - Docker and Deployment
Which Dockerfile instruction is used to expose the port your Spring Boot application listens on?
AEXPOSE 8080
BPORT 8080
COPEN 8080
DLISTEN 8080
Step-by-Step Solution
Solution:
  1. Step 1: Understand Dockerfile instructions for ports

    The correct instruction to declare a port is EXPOSE followed by the port number.
  2. Step 2: Confirm the port number for Spring Boot

    Spring Boot defaults to port 8080, so EXPOSE 8080 is correct.
  3. Final Answer:

    EXPOSE 8080 -> Option A
  4. Quick Check:

    Expose port instruction = EXPOSE [OK]
Quick Trick: Use EXPOSE to declare container ports [OK]
Common Mistakes:
  • Using PORT or OPEN which are invalid Dockerfile commands
  • Forgetting to expose the port

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes