/actuator/healthhttp://localhost:8080/actuator/health/actuator/healthhttp://localhost:8080/actuator/healthbuild.gradle or pom.xml, add the Actuator dependency. Then, in src/main/resources/application.properties, enable the health endpoint by adding management.endpoints.web.exposure.include=health.The Actuator dependency provides the health endpoint. You must expose it explicitly in application.properties.
Dockerfile that uses openjdk:17-jdk-slim as the base image. Copy the built jar file named app.jar into the container and set the command to run it with java -jar /app.jar.Use the official OpenJDK 17 slim image. Copy your jar to /app.jar and run it with java -jar.
Dockerfile, add a HEALTHCHECK instruction that runs curl -f http://localhost:8080/actuator/health || exit 1 every 30 seconds with a timeout of 5 seconds.The HEALTHCHECK runs curl to check the health endpoint. If curl fails, it exits with 1 to mark unhealthy.
Dockerfile, add an EXPOSE 8080 instruction so Docker knows the app listens on port 8080.Expose port 8080 so Docker knows which port the app uses.
What is the main purpose of adding a HEALTHCHECK instruction in a Dockerfile for a Spring Boot application?
Which of the following is the correct syntax to add a health check in a Dockerfile for a Spring Boot app that exposes /actuator/health on port 8080?
?
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
Identify the error in this Dockerfile health check instruction for a Spring Boot app:
HEALTHCHECK CMD curl http://localhost:8080/actuator/health || exit 1
You want Docker to check your Spring Boot app health every 30 seconds, retry 3 times before marking unhealthy, and start checking only after 10 seconds of container start. Which HEALTHCHECK instruction correctly implements this?
Pass the test and this pattern moves unknown