0
0
Dockerdevops~20 mins

Alert setup for container health in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Container Health Alert Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding container health checks

Which of the following best describes the purpose of a HEALTHCHECK instruction in a Dockerfile?

AIt specifies the network ports that the container exposes.
BIt sets the container's resource limits like CPU and memory usage.
CIt defines a command that Docker runs to test if the container is working properly.
DIt installs monitoring software inside the container.
Attempts:
2 left
💡 Hint

Think about how Docker knows if a container is healthy or not.

💻 Command Output
intermediate
1:30remaining
Interpreting Docker container health status

What is the output of the following command if the container named webapp is healthy?

docker inspect --format='{{.State.Health.Status}}' webapp
Ahealthy
Bunhealthy
Cstarting
Dexited
Attempts:
2 left
💡 Hint

The command shows the health status of the container.

🔀 Workflow
advanced
2:00remaining
Setting up alerting for unhealthy containers

You want to receive an alert when a Docker container becomes unhealthy. Which workflow below correctly describes the steps to achieve this using Docker events and a simple script?

ARun <code>docker events</code> to listen for container health status changes, filter for 'unhealthy' events, then trigger an alert script.
BUse <code>docker ps</code> to list containers and manually check health status every hour.
CConfigure the container to send email alerts directly from inside the container when unhealthy.
DRestart the container automatically without monitoring health status.
Attempts:
2 left
💡 Hint

Think about how to get real-time notifications from Docker.

Troubleshoot
advanced
2:00remaining
Diagnosing why a container health check fails

A container's health check keeps failing even though the service inside is running fine. Which of the following is the most likely cause?

AThe container has no network access.
BThe container image is missing.
CDocker daemon is not running.
DThe health check command is incorrect or does not return the expected exit code.
Attempts:
2 left
💡 Hint

Consider what the health check command does and how Docker interprets its result.

Best Practice
expert
2:30remaining
Choosing the best health check command for a web server container

Which health check command is the best choice to monitor a web server running inside a Docker container?

Aping -c 1 localhost
Bcurl -f http://localhost:80/ || exit 1
Cps aux | grep nginx
Decho 'healthy'
Attempts:
2 left
💡 Hint

Think about a command that verifies the web server is responding correctly.