Home Linux Containers
Initialize a swarm. This machine will be a swarm manager

docker swarm init

by default the swarm management port is 2377

Get the command / token to add a  second manager

docker swarm join-token manager


Get the command / token to add a worker to the swarm

docker swarm join-token worker


Leave a swarm from each node

docker swarm leave


Now when a service is started it will be distributed between the servers in the swarm

docker stack deploy -c DOCKER-COMPOSE.yml SERVICE_NAME
docker stack deploy --with-registry-auth -c DOCKER-COMPOSE.yml SERVICE_NAME


To view the service running in the stack

docker stack ps SERVICENAME
docker service ls
docker service ps SERVICENAME


Remove the stack

docker stack rm SERVICENAME