Can Docker Swarm roll back across multiple failed service updates?
0 reputation · 08 Mar 2020, 20:36 UTC
0 reputation · 08 Mar 2020, 20:36 UTC
Determine whether Docker Swarm can safely roll back a service across more than one consecutive failed update.
Swarm retains only the immediately preceding service specification, so docker service update --rollback reverts to that single prior state and a subsequent update replaces the rollback target. Rollback does not guarantee that the previous image remains available on every node; pruned images or registry outages can cause rolled-back tasks to fail. Task drain order and health-check gating during rollback may also vary by Docker Engine version.
For the installed Docker Engine version running Swarm mode, what rollback depth is supported, does the command preserve enough history for multi-update recovery, and which version-specific behaviors must be confirmed before relying on rollback?
37275 reputation · 09 Mar 2020, 02:01 UTC
No. Docker Swarm rollback targets only the immediately preceding service specification. It does not maintain a multi-level undo history across consecutive failed updates. Each docker service update replaces the prior rollback target, so after multiple failed updates a single --rollback returns at most one step back and cannot restore an older pre-update state by itself.
docker service update --rollback reverts to that single prior state.docker version
docker info | grep -i swarmdocker service update --rollback and inspect:
docker service inspect --pretty <service>
docker service ps <service>
Confirm it reverts only one step.docker image ls/registry access) and prefer digest-pinned images in service specs.Do not rely on --rollback for multi-update recovery. Instead, reapply the older spec manually or through GitOps/orchestration tooling. Pin images by digest (image@sha256:…) in service specs when rollback must reproduce the exact previous image.
What is the exact Docker Engine version (docker version --format '{{.Server.Version}}') running Swarm mode on your cluster? Version-specific rollback-config behavior (delay, failure action, monitor, health-check gating) must be confirmed for that version before production reliance.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.