When you create a service or scale it in Swarm mode, scheduler
on Elected Leader
(one of the managers) will select node to start the service. There are currently 3 strategies available for leaders.
The spread
and binpack
compute the rank according to the available CPU node, its RAM, and the number of containers that it has. The random
strategy does not use calculations. It selects node in random order and is mainly intended for debugging.
According to the spread
strategy, Swarm is optimized for the node with the least number of containers. The binpack
strategy forces Swarm to optimize for the node that is most packed.
Swarm uses by default. Keep in mind that you can Constraint
Containers and on certain nodes.
Unable to set strategies in docker version 1.12.1 (latest version to publish date)
source share