Bird
0
0

Given this Dockerfile snippet, what will Docker report as the container health status if the Spring Boot app's /actuator/health endpoint returns HTTP 500?

medium📝 component behavior Q13 of 15
Spring Boot - Docker and Deployment

Given this Dockerfile snippet, what will Docker report as the container health status if the Spring Boot app's /actuator/health endpoint returns HTTP 500?

HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health || exit 1
Ahealthy
Bunknown
Cstarting
Dunhealthy
Step-by-Step Solution
Solution:
  1. Step 1: Understand curl --fail behavior on HTTP 500

    The curl --fail option causes curl to exit with error on HTTP status codes 400 or above.
  2. Step 2: Connect curl failure to Docker health status

    Since curl fails, the HEALTHCHECK command exits with 1, marking container as unhealthy.
  3. Final Answer:

    unhealthy -> Option D
  4. Quick Check:

    HTTP 500 triggers curl failure = unhealthy [OK]
Quick Trick: curl --fail fails on HTTP 500, so container becomes unhealthy [OK]
Common Mistakes:
  • Assuming HTTP 500 still means healthy
  • Confusing 'starting' with unhealthy status
  • Thinking Docker ignores health check failures

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes