Estimate container restart counts and backoff delays under different restart policies.
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.
Total Backoff
totalBackoff = initialBackoff × (2^restarts − 1)
'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.
Docker caps the backoff at a platform-specific maximum (typically around 2 minutes on recent versions), preventing extremely long delays after many restarts.