Recall & Review
beginner
What is the purpose of a health check in Docker?
A health check in Docker helps to automatically verify if a container is running correctly and is ready to serve requests. It ensures the container is healthy and can restart or alert if it is not.
Click to reveal answer
beginner
How do you define a health check in a Dockerfile?
You use the
HEALTHCHECK instruction in a Dockerfile to specify a command that tests the container's health. For example: <br>HEALTHCHECK --interval=30s CMD curl -f http://localhost:8080/actuator/health || exit 1Click to reveal answer
beginner
What Spring Boot feature is commonly used to support Docker health checks?
Spring Boot Actuator provides an endpoint
/actuator/health that returns the health status of the application. Docker health checks can call this endpoint to verify if the app is healthy.Click to reveal answer
intermediate
What does Docker do if a health check fails repeatedly?
If a health check fails repeatedly, Docker marks the container as unhealthy. Depending on the orchestration setup, it can restart the container or notify the user to fix the issue.
Click to reveal answer
intermediate
Why is it important to set a proper interval and timeout for Docker health checks?
Setting a proper interval and timeout balances between timely detection of issues and avoiding unnecessary load on the container. Too frequent checks can cause overhead; too slow checks delay problem detection.
Click to reveal answer
Which Dockerfile instruction is used to add a health check?
✗ Incorrect
The correct instruction to define a health check in a Dockerfile is HEALTHCHECK.
What Spring Boot endpoint is typically used for Docker health checks?
✗ Incorrect
Spring Boot Actuator exposes the /actuator/health endpoint to report application health.
What happens if a Docker container's health check fails multiple times?
✗ Incorrect
Docker marks the container as unhealthy if health checks fail repeatedly.
Which command is a good example of a Docker health check for a Spring Boot app?
✗ Incorrect
Curling the /actuator/health endpoint checks if the Spring Boot app is healthy.
Why should health checks not run too frequently?
✗ Incorrect
Running health checks too often can add unnecessary load to the container.
Explain how to add a health check to a Spring Boot application running in Docker.
Think about how Docker verifies container health and how Spring Boot exposes health info.
You got /4 concepts.
Describe what happens when a Docker container's health check fails repeatedly and why this is useful.
Consider the benefits of automatic health monitoring.
You got /4 concepts.