no

Basics of Docker Swarm Commands

This tutorial requires a connection to the internet as swarm creation and management needs Docker Hub. Requirements Windows Docker CE ...

This tutorial requires a connection to the internet as swarm creation and management needs Docker Hub.

Requirements

  • Windows
  • Docker CE
  • VirtualBox
*Needless to say, a docker for windows must be running.

docker run swarm create
--Download the swarm image locally. Returns a unique id that is required to create a cluster. Example: TOKEN_ID.

docker-machine create -d hyperv --swarm --swarm-master --swarm-discovery token://TOKEN_ID swarm-master
--Create the swarm. controller.

docker-machine create -d hyperv --swarm --swarm-discovery token://TOKEN_ID swarm-node-01
docker-machine create -d hyperv --swarm --swarm-discovery token://TOKEN_ID swarm-node-02
--Add swarm nodes

Use --virtualbox-no-vtx-check, if you're going to use virtualbox

--List all the running machines
docker-machine ls
docker run swarm list token://TOKEN_ID

--Remove from the swarm
docker node rm swarm-node-01

--Demote a swarm master so it can be deleted
docker node demote swarm-master

--Remove the node docker machine
docker-machine rm swarm-node-01

--connect to the master node
docker-machine ssh swarm-master

--must be executed on master node
--creates a swarm
docker swarm init --advertise-addr <SWARM-MASTER-IP>

--login to swarm-node-01 and swarm-node-02 and perform the join command below
--join a machine as a node to the swarm
docker swarm join --token TOKEN_ID <swarm-master-ip>:2377

--what if we forgot the token for joining the swarm?
docker swarm join-token worker

--displays the information about the swarm
docker node ls

Reference
  • https://docs.docker.com/engine/swarm/stack-deploy/#push-the-generated-image-to-the-registry

Related

docker 809056365996165762

Post a Comment Default Comments

item