Install Docker first
Docker swam init - Is the command to install Docker swarm in system
Docker node ls - to list the Node details
Just copy post the token provided by Docker master to the Client machine to join the master
Note: Like docker , in docker swarm we are not going to create containers, instead we need to create service which will create containers in Dockers swarm
docker service create httpd:latest <<<<<< It will create container with the httpd image
docker service ls <<<<<<<<<<<<<<<<<<<<<<<<<< To list the service details
docker service inspect <<<<<<<<<<<<<<<<<<<<<<<<<<<< To inspect the service in details , will show containers IP details etc...
docker service logs <servicename> <<<<<<<<<<<<<<<<<<<<<<<< To show the logs in container
Docker service ps - to see the container details in swarm
docker service scale servicename=10 , it will scale the container to 10 in a single command
To scale down
docker service scale serivce=2 ,, scale down the containers to 2
To left the Node from Dockerswarm master
docker swam leave ,, Execute the command in Node to leave the node from master
Note: While you leave the Node if it has any containers running, it will automatically comes up in rest of the nodes or master machine.
Docker swam disadvantage:
If you scale up the containers number in docker swam , even the master nodes get the container gets created.
Note: As per my understanding it is against logic to get the master also gets the container created. But while coming to the K8's world this problem gets resolved by default.
Setting up of additional master node and route the traffic is very difficult.
Environment variable is not fully or not at all supported in Docker swarm
In Docker Swarm auto scaling is not supported.