Objective: To be able to run more than 10 browsers and using multiple machines(Server1,2).
Docker Swarm requires few ports to be open for it to work. These are : –
-TCP port 2377. This port is used for communication between the nodes of a Docker Swarm or cluster. It only needs to be opened on manager nodes.
-TCP and UDP port 7946 for communication among nodes (container network discovery).
-UDP port 4789 for overlay network traffic (container ingress networking).
Install Docker
First install docker on all 2 machines.eg Server 1,2
1 | curl -SsL https://get.docker.com | sh |
Then add the ubuntu user to the docker group, so we don’t need to use sudo everytime we use the docker command
1 | sudo usermod -aG docker ubuntu |
On Server 1
1 | docker swarm init --advertise-addr=82.66.x.x - Here 82.66.x.x is the public IP of the machine. |
Now docker swarm is ready and nodes can connect to it, ssh into the Server 2 grid machine and run the following command
On Server 2
1 | docker swarm join --token SWMTKN-1-.......... |
1 | docker info |
Run the following command to deploy docker swarm — https://goo.gl/Fsq6fu : –
1 | docker stack deploy --compose-file grid.yaml foobar |
To view the status of the docker swarm : –
1 | docker stack ps foobar |
To shut down docker swarm
1 | docker stack rm foobar |
To debug a specific container
1 | docker logs -f container-id- |
To leave docker swarm, type the following command both on manager node and worker node
1 | docker swarm leave —force |
Slides – https://goo.gl/qjifHq
Instructions – https://goo.gl/gzhg1m
Grid Yaml – https://goo.gl/Fsq6fu
http://play-with-docker.com