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)
- Refer Here for docker swarm article
- Lets create 3 nodes in aws and install docker in it
- 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
- Now lets login into the nodes which would like to join the swarm as a worker node
- now lets login into the worker node and execute the following
- Lets try to create a service where we describe the number of replicas
docker service create --replicas 2 --name httpd httpd:latest
- Now lets scale the number of replicas
docker service scale httpd=4
- Lets create a service by exposing ports
- Lets login into the container and check the network interfaces