Docker Restart Policy Estimator
Estimate container restart counts and backoff delays under different restart policies.
Inputs
Expected crash rate without restart limits.
Maximum restart attempts (on-failure:N policy).
Docker's initial restart delay (doubles each attempt).
Time window to project restart behavior over.
Restart Count
5
Total Backoff Delay
31.0seconds
Max Single Restart Delay
16.0seconds
Expected Crashes in Window
72.0
Step by step
Expected crashes in window
3/h × 24h
= 72.0
Actual restarts (capped by policy)
min(72.0, 5)
= 5
Total backoff time (exponential)
1s × (2^5 − 1)
= 31.0s
How it works
Docker's restart backoff doubles with each attempt: delay(n) = initialBackoff × 2^(n−1). Total backoff = initialBackoff × (2^restarts − 1). The on-failure:N policy caps restarts, preventing infinite crash loops from consuming resources.
Formula
Total Backoff
totalBackoff = initialBackoff × (2^restarts − 1)
- initialBackoff
- Initial delay in seconds
- restarts
- Number of restart attempts
Frequently Asked Questions
What's the difference between 'always' and 'on-failure'?
'always' restarts regardless of exit code (even clean exits); 'on-failure:N' only restarts on non-zero exit codes, up to N times, preventing infinite loops from application bugs.
Does Docker cap the backoff delay?
Docker caps the backoff at a platform-specific maximum (typically around 2 minutes on recent versions), preventing extremely long delays after many restarts.
You might also need
- Docker Container Startup Time CalculatorCommonly used together
- Docker Log Growth CalculatorCommonly used together
- Docker Container Density CalculatorCommonly used together
- Docker Container Memory CalculatorAlso in Docker
- Docker CPU Limit CalculatorAlso in Docker
- Docker Image Size CalculatorAlso in Docker