Note: this command must be run on the manager node.
Note: Use the --force-new-cluster
flag to use existing settings. Swarm settings are in /var/lib/docker/swarm
.
docker swarm init --advertise-addr IP
Note: this command must be run on the manager node.
docker swarm join-token worker
Note: this command must be run on the manager node.
docker swarm join-token manager
Note: this command must be run on the node you want to remove from the swarm.
docker swarm leave
Note: this command must be run on the manager node.
docker node ls
Note: this command must be run on the manager node.
docker node rm NODE_ID
Note: this command must be run on the manager node.
docker node inspect NODE_ID
Note: this command must be run on the manager node.
docker node demote NODE_ID
Note: this command must be run on the manager node.
docker node update --availability drain NODE_ID
Note: this command must be run on the manager node.
docker service create IMAGE
Note: this command must be run on the manager node.
docker service create --mode global IMAGE
Note: this command must be run on the manager node.
docker service rm SERVICE_ID
Note: this command must be run on the manager node.
docker service ls
Note: this command must be run on the manager node.
docker service ps SERVICE_ID
Note: this command must be run on the manager node.
docker service update --constraint-add node.role==worker SERVICE_ID
Note: To remove the above restriction, use the command docker service update --constraint-rm node.role==worker SERVICE_ID
.
Note: this command must be run on the manager node.
docker service update --replicas NUMBER_OF_REPLICAS SERVICE_ID
Or
docker service scale SERVICE_ID=NUMBER_OF_REPLICAS
Note: this command must be run on the manager node.
docker stack deploy --compose-file docker-compose.yml STACK_NAME
Note: this command must be run on the manager node.
docker stack ls
Note: this command must be run on the manager node.
docker stack rm STACK_NAME
docker-machine create --virtualbox-no-vtx-check --virtualbox-cpu-count=2 -d virtualbox VM_NAME
docker-machine ls
docker-machine rm VM_NAME
docker-machine start VM_NAME
docker-machine stop VM_NAME
docker-machine ssh VM_NAME