Force the swarm to rebalance

You do not usually need to force your swarm to rebalance its tasks. However, when you add a new node to a swarm or a node reconnects to the swarm after a period of unavailability, the swarm does not automatically give a workload to the idle node. This is a design decision; if the swarm periodically shifts tasks to different nodes for the sake of balance, the clients using those tasks would be disrupted. The goal is to avoid disrupting running services for the sake of balance across the swarm. When new tasks start, or when a node with running tasks becomes unavailable, those tasks are given to less busy nodes.


To force the swarm to rebalance its tasks:

Use the docker service update command with the --force or -f flag to force the service to redistribute its tasks across the available worker nodes. This causes the service tasks to restart. Client applications may be disrupted. If configured, your service will use a rolling update.