This is a creation in Article, where the information may have evolved or changed.
Docker Swarm manageThe option of the command is flStrategy used to specify the scheduler filtered item of the schedule strategy , and its variable is defined as follows ( cli/flags.go ):
flStrategy = cli.StringFlag{ Name: "strategy", Usage: "placement strategy to use [" + strings.Join(strategy.List(), ", ") + "]", Value: strategy.List()[0],}
strategyThe default value is SpreadPlacementStrategy .
strategyThe actual definition in the code is PlacementStrategy , one interface :
// PlacementStrategy is the interface for a container placement strategy.type PlacementStrategy interface { // Name of the strategy Name() string // Initialize performs any initial configuration required by the strategy and returns // an error if one is encountered. // If no initial configuration is needed, this may be a no-op and return a nil error. Initialize() error // RankAndSort applies the strategy to a list of nodes and ranks them based // on the best fit given the container configuration. It returns a sorted // list of nodes (based on their ranks) or an error if there is no // available node on which to schedule the container. RankAndSort(config *cluster.ContainerConfig, nodes []*node.Node) ([]*node.Node, error)}
RankAndSortit returns a list that matches the criteria node ( Docker Engine that is), and the elements in the list are sorted by the matching degree.