docker healthcheck ai_generated true

health: starting (unhealthy)

ID: docker/healthcheck-failing

Also available as: JSON · Markdown
92%Fix Rate
94%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
24 active

Root Cause

Container's HEALTHCHECK command is failing — the application isn't ready or the check is misconfigured.

generic

Workarounds

  1. 93% success Debug the health check: docker inspect --format='{{.State.Health}}' <container>
    Shows the last N health check results and exit codes

    Sources: https://docs.docker.com/reference/dockerfile/#healthcheck

  2. 90% success Test the health command inside the container: docker exec <container> curl -f http://localhost:8080/health
    Run the same command the HEALTHCHECK uses to see what fails

Dead Ends

Common approaches that don't work:

  1. Removing HEALTHCHECK from Dockerfile 70% fail

    Container appears healthy but may not actually be serving traffic

  2. Setting the health check to always return 0 90% fail

    Defeats the purpose; orchestrators think the container is always healthy

Error Chain

Frequently confused with: