Docker :14

DevOps Classroom Series – 02/Apr/2021

Docker Multi host networking

  • In Docker Overlay network driver provides multi host networking
  • Refer Here to understand overlay networks
  • To create a overlay network in docker we use docker swarm.
  • Docker Swarm gives management & Orchestration features
  • In Docker Swarm we specify desired state (i want some application to be run in two containers and swarm will try to maintain the state) Preview
  • Refer Here for docker swarm article
  • Lets create 3 nodes in aws and install docker in it Preview
  • Lets understand some key terms in docker swarm
    • Swarm: Multiple Docker hosts run in swarm mode to act as managers and workers
    • Task: The manager distributes the tasks to run inside the nodes. A task consists of a Docker container and the commands to run inside the container
    • Service: This defines the task
    • Node: An individual system with docker installed
  • Manager node initializes the swarm cluster by using the ip address of manager Preview Preview
  • Now lets login into the nodes which would like to join the swarm as a worker node Preview Preview
  • now lets login into the worker node and execute the following Preview
  • Lets try to create a service where we describe the number of replicas
docker service create --replicas 2 --name httpd httpd:latest

Preview
Preview
Preview
  • Now lets scale the number of replicas
docker service scale httpd=4

Preview
Preview
  • Lets create a service by exposing ports Preview Preview Preview
  • Lets login into the container and check the network interfaces Preview Preview