10.40.100.143 docker-node0.venic.com10.40.100.144 docker-node1.venic.com Original Swarm Mirror Direct Start 10.40.100.143 onDocker run-d--restart=always--name node0 docker-registry.venic.com:5000/swarm:latest Join--advertise= 10.40.100.143:2375 consul://docker-consul.venic.com:8500 10.40.100.144 onDocker run-d--restart=always--name node1 docker-registry.venic.com:5000/swarm:latest Join--advertise=10.40.100 .144:2375 consul://docker-consul.venic.com:8500 view the cluster status on the manager node, with 2 more node nodes # docker-h: 4000 info Containers:2Running:2paused:0stopped:0Images:6Server version:swarm/1.2.5role:primarystrategy: Spread--The default equalization mode Filters:health, Port, Containerslots, dependency, affinity, constraintNodes:2 docker-node0.venic.com:10.40.100.143:2375 └ID:IP3U:TRP7:ZJTS:L3SX:UU4R:VVB5:B4LE:QNOL:MALC:A4BX:GFC7:WJPV└status:healthy└containers:1 (1 Running, 0 Paused, 0 Stopped)└reserved cpus:0/1└reserved memory:0 b/2.052 GiB└labels:kernelversion=3.10.0-514.2.2.el7.x86_64, Operatingsystem=centos Linux 7 (Core), storagedriver= Devicemapper└updatedat:2016-12-22t11:26:27z└serverversion:1.12.5 docker-node1.venic.com:10.40.100.144:2375 └id:txyv:2vvm:h32t:dwdn:ad5m:z22s:rrlj:kyn2:sknp:yfli:4rui:grpm└status:healthy└containers:1 (1 Running, 0 Paused, 0 Stopped)└reserved cpus:0/1└reserved memory:0 b/2.052 GiB└labels:kernelversion=3.10.0-514.2.2.el7.x86_64, Operatingsystem=centos Linux 7 (Core), storagedriver= Devicemapper└updatedat:2016-12-22t11:26:35z└serverversion:1.12.5Plugins:Volume:Network:Swarm:NodeID:is manager:falseNode Address:Security Options:Kernel version:3.10.0-514.2.2.el7.x86_64Operating System:linuxArchitecture:amd64Cpus:2Total memory:4.103 GiBname:27fbbfe0fae4Docker Root Dir:Debug Mode (client): falseDebug Mode (server): falsewarning:no Kernel memory limit support
Swarm scheduling Policy
Swarm when the schedule node runs the container, it calculates the node that is best suited to run the container according to the specified policy, and currently supports the following policies: Spread, binpack, random.
Random, as the name implies, randomly selects a node to run the container, typically used for debugging purposes, and the spread and binpack policies compute the nodes that should run the container based on the available CPU, RAM, and the number of containers that are running on each node.
Under the same conditions, the spread strategy chooses the node that runs the fewest containers to run the new container, and the Binpack policy chooses the machine that runs the most centralized container to run the new node (the Binpack strategy causes Swarm to optimize For the Container which are most packed.).
Using the spread policy will allow the container to be evenly distributed across nodes in the cluster, and once a node is hung up, it will only lose a small portion of the container.
The binpack strategy maximizes the avoidance of container fragmentation, which means that the Binpack strategy leaves unused nodes as far as possible for containers that need more space, and as much as possible to run containers on top of one node.
Docker Cluster Lab Environment Deployment--swarm "5 Container Starter Kit--node"