Health ChecksIntermediate
1Question 1 of 1
dockerfileHow do HEALTHCHECK instructions work in Dockerfiles?
Explanation & Concept
The `HEALTHCHECK` instruction tells Docker how to test whether a container is functioning properly, beyond merely checking if its PID is still running.
Code Example
dockerfile
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1How It Works & Key Takeaways
Orchestrators like Docker Compose and Kubernetes monitor health checks to automatically restart unhealthy containers or stop routing traffic to them.
Mock Test · 1 Questions · Optional
Ready for Docker Swarm Basics?
Take a quick test to evaluate yourself, or move straight to the next module.
Advanced1 questions