beginnerDockerfile Instructions & Multi-Stage Builds

What does HEALTHCHECK do, and how does Docker use the result?

HEALTHCHECK defines a command Docker runs periodically inside the container (e.g., curl against an actuator/health endpoint). Based on the exit code, Docker marks the container's health status as starting, healthy, or unhealthy, visible via docker ps. Orchestrators and load balancers can use this status to avoid routing traffic to a container that is technically running but not actually ready to serve requests.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why might WORKDIR be safer than using RUN cd?← Back to all Docker questions