How nodes work (2024)

Table of Contents
Worker nodes Learn more

Swarm mode lets you create acluster of one or more Docker Engines called a swarm. A swarm consistsof one or more nodes: physical or virtual machines running DockerEngine.

There are two types of nodes:managers andworkers.

How nodes work (1)

If you haven't already, read through theSwarm mode overview andkey concepts.

Manager nodes handle cluster management tasks:

Using aRaft implementation, the managersmaintain a consistent internal state of the entire swarm and all the servicesrunning on it. For testing purposes it is OK to run a swarm with a singlemanager. If the manager in a single-manager swarm fails, your servicescontinue to run, but you need to create a new cluster to recover.

To take advantage of Swarm mode's fault-tolerance features, we recommendyou implement an odd number of nodes according to your organization'shigh-availability requirements. When you have multiple managers you can recoverfrom the failure of a manager node without downtime.

  • A three-manager swarm tolerates a maximum loss of one manager.

  • A five-manager swarm tolerates a maximum simultaneous loss of twomanager nodes.

  • An odd number N of manager nodes in the cluster tolerates the loss of at most (N-1)/2 managers.Docker recommends a maximum of seven manager nodes for a swarm.

    Important

    Adding more managers does NOT mean increasedscalability or higher performance. In general, the opposite is true.

Worker nodes

Worker nodes are also instances of Docker Engine whose sole purpose is toexecute containers. Worker nodes don't participate in the Raft distributedstate, make scheduling decisions, or serve the swarm mode HTTP API.

You can create a swarm of one manager node, but you cannot have a worker nodewithout at least one manager node. By default, all managers are also workers.In a single manager node cluster, you can run commands like docker service create and the scheduler places all tasks on the local engine.

To prevent the scheduler from placing tasks on a manager node in a multi-nodeswarm, set the availability for the manager node to Drain. The schedulergracefully stops tasks on nodes in Drain mode and schedules the tasks on anActive node. The scheduler does not assign new tasks to nodes with Drainavailability.

Refer to thedocker node updatecommand line reference to see how to change node availability.

You can promote a worker node to be a manager by running docker node promote.For example, you may want to promote a worker node when youtake a manager node offline for maintenance. Seenode promote.

You can also demote a manager node to a worker node. Seenode demote.

Learn more

  • Read about how Swarm modeservices work.
  • Learn howPKI works in Swarm mode.
How nodes work (2024)
Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 6093

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.