docker
healthcheck
ai_generated
true
container is unhealthy
ID: docker/container-unhealthy
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 24 | active | — | — | — |
Root Cause
Docker container health check is failing. The application inside the container is not responding to health probes correctly.
genericWorkarounds
-
92% success Inspect the health check log to see exact failure reason
docker inspect --format='{{json .State.Health}}' <container_name> | jq '.Log[-1]' This shows the last health check result including exit code and output.Sources: https://docs.docker.com/reference/dockerfile/#healthcheck
-
90% success Exec into the container to debug the health check
docker exec -it <container_name> sh # Then run the health check command manually: curl -f http://localhost:8080/health # Or whatever command is in the HEALTHCHECK instruction. # Check if the process is listening: netstat -tlnp || ss -tlnp # Check logs: cat /var/log/app.log
Sources: https://docs.docker.com/reference/cli/docker/container/exec/
Dead Ends
Common approaches that don't work:
-
Remove the HEALTHCHECK from Dockerfile
80% fail
Hides the real problem; orchestrators cannot detect failures
Error Chain
Frequently confused with: