A thirty second interval with three retries
Ninety seconds before anything notices, and Docker does nothing when it does
port: 8080 path: /healthz interval: 30s retries: 3
Generate a HEALTHCHECK and see how long it takes to notice a problem. Read the first finding before relying on it, because Docker's response to an unhealthy container is nothing at all.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Generate. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
Ninety seconds before anything notices, and Docker does nothing when it does
port: 8080 path: /healthz interval: 30s retries: 3
No shell and no curl, so a conventional check is permanently failing
FROM gcr.io/distroless/static:nonroot EXPOSE 8080
Boot failures count against the retries, so a slow starter never becomes healthy
port: 3000 interval: 10s retries: 3
These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
Plain Docker records the state and does nothing. A restart policy only reacts to the process exiting, and an unhealthy container has not exited.
Instead:Use the state for visibility and for Compose's depends_on. Anything that acts on it has to be Swarm, an orchestrator or a watcher you run.
Failures while the application is still booting count against the retries, so a slow starter is marked unhealthy before it has ever been ready.
Instead:Set --start-period comfortably longer than the slowest cold start.
The binary is not there. The check exits 127, which counts as a failure, so the container is permanently unhealthy.
Instead:Use the language runtime already in the image, or copy in a small static health binary.
A restart policy reacts to the process exiting, and an unhealthy container has not exited. So it sits there, marked unhealthy, still published and still receiving traffic, indefinitely.
Swarm replaces an unhealthy task and Kubernetes has a liveness probe. Plain Docker has neither. Compose can wait for it with depends_on and condition: service_healthy, which is a startup ordering feature rather than a recovery one. If something must restart on unhealthy, that something has to be you.
Not the interval alone. With a 30 second interval and three retries a failure takes ninety seconds to register, during which the container is reported healthy and anything routing on health keeps sending traffic.
A container that takes forty seconds to open its port and has a thirty second interval is marked unhealthy before it has finished starting. Anything waiting on service_healthy then gives up, so a slow dependency fails a stack that would have worked. Failures during the start period do not count, and a success ends it early.
distroless and scratch have no shell, so both CMD-SHELL and curl are absent. Alpine has a shell and no curl. A missing command exits 127, which counts as a failure, so the container is permanently unhealthy for a reason that looks like the application.
0 is healthy, 1 is unhealthy, 2 is reserved and anything else is treated as unhealthy. A check that pipes through something returning 2 on partial success reports unhealthy for a reason that is nowhere in the output. End it with an explicit exit.
It starts a process in the container's cgroup, so it uses the container's CPU quota and memory limit. On a tight limit a heavy check competes with the application, and across hundreds of containers a one-second interval is a real fraction of the host.