Docker Swarm is a gathering and programming tool for Docker containers. With it, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system. Its cluster also provides administrators and developers with the ability to add or subtract container iterations as computing demands change. Swarm mode exists natively for Docker Engine, the layer between the OS and container images. Also  integrates the orchestration capabilities of Docker Swarm into Docker Engine 1.12 and newer releases.

Swarm mainly uses three different strategies to determine on which nodes each container should run:

  • Spread — It acts as the default setting and balances containers across the nodes in a cluster based on the nodes available CPU and RAM, as well as the number of containers it is currently running. The advantage of the Spread strategy is, if the node fails, only a few containers are lost.
  • BinPack — It schedules containers to fully use each node. It moves on to the next in the cluster, if a node is full. The advantage of BinPack is it uses a smaller amount of infrastructure and leaves more space for larger containers on unused machines.
  • Random — It can choose a node at random.

docker_swam

Docker Swarm filters

Swarm has five filters for scheduling containers:

  • Constraint — Constraints are also known as node tags, constraints are key/value pairs associated to particular nodes. If a user can select a subset of nodes when building a container and specify one or multiple key value pairs.
  • Affinity — This is used to ensure containers run on the same network node, the Affinity filter tells one container to run next to another based on an identifier, image or label.
  • Port — Ports represent a unique resource that is, when a container tries to run on a port that’s already occupied, it will move to the next node in the cluster.
  • Dependency — This filter schedules moves on the same node, when containers depend on each other.
  • Health — Working in the event if a node is not functioning properly, this filter will prevent scheduling containers on it.

 

Conclusion

A Docker Swarm cluster can provide administrators and developers with the ability to add or subtract container iterations as computing demands change. Bayinfotech creates a cooperative group of systems that can provide redundancy, enabling Docker Swarm failover if one or more nodes experience an outage.