0
0
Dockerdevops~30 mins

Manager and worker nodes in Docker - Mini Project: Build & Apply

Choose your learning style9 modes available
Manager and Worker Nodes in Docker Swarm
📖 Scenario: You are setting up a Docker Swarm cluster to manage containerized applications. The cluster has one manager node and one worker node. You will create the initial swarm, add a worker node, and verify the nodes in the swarm.
🎯 Goal: Learn how to initialize a Docker Swarm manager node, add a worker node to the swarm, and list the nodes in the swarm.
📋 What You'll Learn
Use docker swarm init to create the manager node
Use docker swarm join with the correct token to add a worker node
Use docker node ls to list all nodes in the swarm
💡 Why This Matters
🌍 Real World
Docker Swarm is used to manage and orchestrate containers across multiple machines, making it easier to deploy and scale applications.
💼 Career
Understanding manager and worker nodes in Docker Swarm is essential for roles involving container orchestration, cloud infrastructure, and DevOps automation.
Progress0 / 4 steps
1
Initialize the Docker Swarm Manager Node
Run the command docker swarm init --advertise-addr 192.168.1.100 to initialize the current machine as the manager node with the IP address 192.168.1.100.
Docker
Need a hint?

The --advertise-addr option sets the IP address the manager node uses to communicate with other nodes.

2
Get the Worker Join Token
Run the command docker swarm join-token worker -q on the manager node to get the worker join token.
Docker
Need a hint?

The -q option outputs only the token string, which is needed to join worker nodes.

3
Join the Worker Node to the Swarm
On the worker node, run the command docker swarm join --token 192.168.1.100:2377 replacing <token> with the token from Step 2 to join the swarm.
Docker
Need a hint?

Replace <token> with the actual token string you got from the manager node.

4
List All Nodes in the Swarm
On the manager node, run docker node ls to list all nodes in the swarm and verify the worker node has joined.
Docker
Need a hint?

The docker node ls command shows all nodes and their roles in the swarm.