Reported symptoms
Health.Statusflips between healthy and unhealthy.- Container stays Up the whole time.
docker logsshows no application errors.- No restart loop.
Evidence provided
$ docker inspect my-app --format '{{json .State.Health}}' | jq .
{
"Status": "unhealthy",
"FailingStreak": 1,
"Log": [
{
"Output": "...",
"ExitCode": 1,
"Start": "2026-08-12T14:32:01Z",
"End": "2026-08-12T14:32:03Z"
},
...
]
}
$ docker logs my-app --tail 20
... normal application output, no errors ...
The probe exit code is non-zero; the application logs are clean.
Resolution path
- Read the probe output.
docker inspect <id> --format "{{json .State.Health}}" | jq .and look at the recentLogentries. TheOutputfield tells you exactly what the probe saw.- Time the probe command manually under load.
- Run the test command inside the container:
docker exec <id> <probe-command>. If the median response time is comparable to the healthcheckinterval, the probe is racing itself. - Replace the probe path.
- Probe
/liveor a similar path that does not touch downstream services. The probe should answer "is the process responsive", not "is the service end-to-end healthy". - **Give the application a
start_period.** - During cold start the application is slower than steady state. Without a generous start_period, the probe fails on cold start and the daemon marks the container unhealthy before it has had a chance to come up.
- Use the orchestrator for end-to-end health.
- Kubernetes readiness/liveness probes, Swarm healthcheck, the load balancer health check - those are the layers that answer the service-level question. The Docker healthcheck is one input to those, not the source of truth.
Verification
- Health.Status stays healthy under steady load.
- Run a load test, watch the probe log, see no flips.
- The probe command is fast.
time docker exec <id> <probe-command>reports a median under 100 ms.- End-to-end health is monitored elsewhere.
- The load balancer and the metrics pipeline still see service-level symptoms that the Docker probe deliberately ignores.