Recall & Review
beginner
What is the purpose of setting up alerts for container health?
Alerts notify you when a container is unhealthy or stops working properly, so you can fix issues quickly and keep your app running smoothly.
Click to reveal answer
beginner
Which Docker command helps check the health status of a container?
The command
docker ps shows container status, including health if a health check is defined.Click to reveal answer
intermediate
How do you define a health check in a Dockerfile?
Use the
HEALTHCHECK instruction with a command that tests the container's health, for example:<br>HEALTHCHECK CMD curl -f http://localhost/ || exit 1
Click to reveal answer
intermediate
What tool can you use to send alerts based on Docker container health status?
You can use monitoring tools like Prometheus with Alertmanager, or Docker events combined with scripts to send alerts via email or messaging apps.
Click to reveal answer
beginner
Why is it important to have a health check command that returns proper exit codes?
Because Docker uses the exit code to decide if the container is healthy (0) or unhealthy (non-zero). This helps Docker and alert systems know the real status.
Click to reveal answer
What does the Docker HEALTHCHECK instruction do?
✗ Incorrect
The HEALTHCHECK instruction runs a command inside the container to check if it is working properly.
Which exit code should a health check command return to indicate the container is healthy?
✗ Incorrect
Exit code 0 means success, so Docker treats the container as healthy.
How can you view the health status of running Docker containers?
✗ Incorrect
The 'docker ps' command shows running containers and their health status if health checks are defined.
Which tool is commonly used to send alerts based on container health metrics?
✗ Incorrect
Prometheus collects metrics and Alertmanager sends alerts when conditions like unhealthy containers occur.
What is a simple way to trigger an alert when a Docker container becomes unhealthy?
✗ Incorrect
Monitoring Docker events for health status changes allows automated alerts when a container becomes unhealthy.
Explain how to set up a health check in a Docker container and why it is useful.
Think about how Docker knows if a container is working well or not.
You got /5 concepts.
Describe a simple alerting approach for Docker container health using available tools.
Consider how you can get notified when a container stops working properly.
You got /4 concepts.