Docker Multihost Networking and Swarm
-
Create 3 servers connected to each other with in a network and install docker on all the three servers
-
How can we enable communication b/w two container running on different hosts
-
Docker has network driver which is called as overlay which can help in connecting two containers running on different hosts
-
Refer Here to understand overlay networks
-
When we are working with multiple docker hosts. It becomes extreemly important for us to ensure
- avoid failures
- Scale the containers
- Simplicity
- Zero Downtime deployments
-
What we are looking for some software which manages this cluster and Orchestrate. This is exactly where Docker Swarm, Kubernetes and Apache mesos (many more) come into play.
-
Docker Swarm creates an overlay network b/w multiple nodes. Refer Here
-
Docker Swarm is a cluster and it has two types of nodes
- Manager Node:
- This is point of contact for us to execute the desired state (Service).
- This nodes dispatches a unit of work (task) to the worker nodes
- You can have multiple manager nodes (only one will be primary manager)
- Worker Node:
- They recieve and execute the tasks dispatched from manager nodes
- Mulitple Nodes can be created
- Agent that runs on this node reports the status of tasks assigned to it back to manager
- Manager Node:
-
Docker Swarm Representation
-
Create the docker swarm cluster as mentioned in the above link
-
Generally docker services will be exposed to the outside world using load balancers.
-
Experiment by doing
- docker network ls (on manager and worker nodes)
-
Some reference applications for conterization
- openmrs
- shopizer
- nopcommerce (linux)