Every container runtime has a default grace period between "please stop" and "you are being killed" — ten seconds in Docker's case. It is easy to read that number as a constant of the platform rather than a parameter you chose, and easier still to never measure what your own services do inside it.
Two things follow from treating it as a default instead of a budget.
The sum is what your users experience
If a restart touches six containers that each take the full grace to exit, the unavailable window is not ten seconds; it is up to a minute, plus startup. That total is the number your rollback spends, and it is the one that has to fit inside whatever tolerance the service has.
restart_cost = Σ(stop_grace_period_i + startup_i) for the containers being replaced
Enter fullscreen mode
Exit fullscreen mode
The interesting failure is when the orchestrator's health-check timeout is smaller than that sum.…