Interview Prep/Docker/Resources, health checks, logging and restarts

Container is `unhealthy` but the app works when tested manually.

IntermediateTroubleshootingResources, health checks, logging and restarts
Answer

Likely causes → Healthcheck command missing in the image (curl: not found), wrong port/path, too-short timeout, runs as a different user, or checks a dependency that's down.

Diagnose →

docker inspect -f '{{json .State.Health}}' c | jq
docker exec c sh -c 'curl -fsS http://localhost:8080/healthz; echo $?'

Fix → Install the needed tool or use the app binary, fix URL, raise timeout/start_period.

Prevent → Test the health command in CI.

All Docker questions Roadmap: Docker & containers

More on Resources, health checks, logging and restarts