Docker Networking
- Docker Networking Architecture is based on Container Network Model (CNM)
- Refer Here for the docker container networking article
Cluster
- A server cluster is group of two or more nodes (servers), that run in parallel to acheive a common goal
- A cluster functions as if it were a single system. A user accessing the cluster should not need to know whether the system is a cluster or individual machine
- Benifits:
- High Availability
- Load Balancing
- Scaling
- Performance
- To manage clusters we generally use cluster orchestration software
- Container Orchestration Softwares
- Docker Swarm
- Kubernetes
- Mesos
- Using Container Orchestration Softwares, we enable
- multi node setups
- we express the desired state rather than commands to create containers
- Generally Orchestration softwares have two kinds of nodes
- master nodes (manager)
- nodes (worker)
- To decide which node is manager there are consensus algorithms like RAFT etc which will choose the manager by election.
Docker Swarm Setup
- Refer Here for the article
- Create 3 ubuntu instances and install docker in them
-
explore swarm command line
- Note the output
Swarm initialized: current node (4zbhonvbfzpzs2dzbbgjcmfz3) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-02wrpqrep3ytgxynjurslwjseu4898o1vvbi0cozh00eth7ova-aswifi8z4zrdwmnl51nzyd7li 172.31.7.10:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
- When the swarm is initialized docker will create an overlay network
- Docker has one more subcommand node
-
Basic interaction diagram
-
In swarm we create services
- Note: Sending the image to docker hub
- For experimentation lets use the container image
shaikkhajaibrahim/qttestapp:1.0
Refer Here - Create a service using test app
docker service create --name testapp --replicas 2 --publish published=5001,target=5000 shaikkhajaibrahim/qttestapp:1.0
- To access the test app use any nodes ip with 5001
- Understanding how overlay works Refer Here