DevOps Classroomnotes 09/Feb/2022

Docker Swarm Contd

  • Each Docker Host can be manager or worker
  • In Docker Swarm we specify the desired state
  • Terminology
  • Nodes:
    • The instance where docker is installed.
    • Two Types
    • Manager Node:
      • We communicate with Manager to specify our service definitions
      • This node will assign unit of work called as tasks to the Worker nodes
    • Worker Node:
      • They recieve & execute the tasks dispatched from manager node
      • An agent runs on the worker node and reports on the tasks assigned to it
  • Swarm Setup:
  • 3 ubuntu instances and install docker (ensure each instance is atleast 2 vcpus 4 GB of RAM)
    Preview
  • Install Docker on all the three nodes
  • On the designated manager node execute
docker swarm init --advertise-addr 172.31.46.65

Preview
* Now login into worker nodes and execute docker swarm join command
docker swarm join --token SWMTKN-1-3cwg22o4p780ip3enz9g5ijzqogl1v5s1a89egwcp56j5pkyk1-5baqd98h34xiabjrtmp0oiqxz 172.31.46.65:2377
* Verify The nodes docker node ls in the manager
Preview
* verify the networks in the manager and nodes docker network ls
Preview
* now lets create service

docker service create --replicas 3 --name apache httpd

Preview
Preview
Preview
* To delete the service execute docker service rm apache

  • Now Lets create a docker service and verify the network connectity
    Preview
  • Exercise: Specify how to verify communication between containers on different nodes in swarm

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner