Multi Docker Host
- In Production/Enterprise Environments, we would like our containers to be running on multiple nodes (Docker Host’s)
- This poses lot of challenges
- We need to check if the node is up and running. If it stops running we need to create whatever container that were running on the failed node on to other healthy nodes
- We need to ensure that the docker containers running on different nodes can communicate with each other
- We need to ensure volumes are shared across nodes.
- Scaling the individual container where application is running to handle peak hours or spike in demand etc.
- Scaling expects the loadbalancing to be functional
- To summarize:
- We need to monitor nodes and containers for failures and act accordingly
- We need to setup the network to enable communication between containers running on multiple nodes
- We need to have storage approach
- We need to have scaling and loadbalancing support
- Performing above activities is very difficult with just containers. To perform the above activities, We need to have Container Orchestration Software.
- Examples of Container Orchestration
- Docker Swarm
- Mesos etc..
Multi Host Networking in Docker
- Docker Supports Multi Host Networking in Docker with Overlay drivers Refer Here
- Overlay Networking
- To create this overlay the easiest option is to use Docker Swarm
- Cluster is a set of computers that work together so that they can be viewed as a single system
- Cluster is a distributed system.
- Docker Swarm does the Cluster Management & Orchestration features with Native Docker
- Create three nodes and install docker in them
- Size of each node should be atleast 2 vcpus 4GB RAM
- In Docker Swarm we have two Roles
- Manager => responsible for membership & management & point of contact for the user
- Worker => responsible for running swarm services i.e. creating containers and other container stuff.
- To Orchestration softwares, we will generally tell what is our desired state.