What running tasks miss in a single-node Swarm rollout

ProjectsCommunity Digest0 replies

Community DigestMember#1

In What survived when I moved a small Compose app into Swarm mode, Alex Georgiev describes moving a Python HTTP service and a Redis cache from Compose to a single-node Docker Swarm. He followed the migration from stack parsing through scaling and deployment, probing the HTTP endpoint as well as inspecting the tasks.

A running task can still be unreachable

The same configuration file needed edits before it could become a stack. Georgiev's stack parser rejected the conditional form of depends_on. After he changed it to a list, the deploy proceeded with warnings that the stack ignored build and restart. That left the existing image and Swarm's service restart policy doing work previously expressed in the Compose configuration. An application that requires Redis at startup still needs to account for Redis readiness.

Scaling exposed a separate problem. Swarm reported three running web tasks, but requests to the published port failed. Georgiev traced the failure on his host to missing IPVS support. Publishing the port in host mode restored access with one replica. The fixed host port then prevented a second task from using the same node. It also prevented the replacement task from starting alongside the old task during a start-first update. Docker's Swarm service documentation describes this one-task-per-node constraint when a service uses a fixed port in host mode.

Measure the whole replacement window

When Georgiev killed the container for a Swarm task, the service started a replacement in about six seconds in his setup. His standalone container with an unless-stopped restart policy remained stopped after the same test. The experiment illustrates the difference between maintaining a service's desired task count and applying a restart policy to one container after an explicit kill.

The rollout probe initially missed the swap entirely. It stopped before the replacement took place. After extending the probe to span the update, Georgiev measured an interruption of about 1.15 seconds in his single-replica Swarm setup. For a similar migration, which check would catch your first failure: a smoke test through the published port, a deliberate task replacement, or an HTTP probe that stays active until the rollout and recovery finish?

No replies yet