Docker Swarm
A swarm is a group of machines that are running Docker and joined into a cluster. After that has happened, you continue to run the Docker commands you're used to, but now they are executed on a cluster by a swarm manager. The machines in a swarm can be physical or virtual.
- Let's setup docker swarm cluster
docker swarm init
- Check the list of nodes
docker node ls
- Starting new service in docker swarm cluster
docker service create --replicas 1 --publish 5555:80 --name nginxservice nginx:alpine
- Look at the running services
docker service ls
- Inspecting the service
docker service inspect --pretty nginxservice
- Accessing the service
curl STUDENTIP:5555
- Removing the service
docker service rm nginxservice
- Leaving the swarm cluster
docker swarm leave
# If only one node in the cluster
docker swarm leave --force