List your current nodes. docker node ls Add a label to a node. docker node update –label-add availability_zone=east <NODE_NAME> docker node update –label-add availability_zone=west <NODE_NAME> View existing labels with: docker node inspect –pretty <NODE_NAME> You can use –constraint when creating a service to restrict which nodes will be used to execute a …
Install the vieux/sshfs plugin on all nodes in the swarm. docker plugin install –grant-all-permissions vieux/sshfs Set up an additional server to use for storage. You can use the Ubuntu 18.04 Bionic Beaver LTS image with a size of Small. On this new storage server, create a directory with a file that can be used for …
Create a compose file for the stack. vi simple-stack.yml version: ‘3’ services: web: image: nginx busybox: image: radial/busyboxplus:curl command: /bin/sh -c “while true; do echo Hello!; sleep 10; done” Deploy the stack and examine it using various commands. docker stack deploy -c simple-stack.yml simple docker stack ls docker stack ps …
Create a simple service running the nginx image. docker service create nginx Create an nginx service with a specified name, multiple replicas, and a published port. docker service create –name nginx –replicas 3 -p 8080:80 nginx Use a template to pass the node hostname to each container as an environment variable. docker service create …
Configuring A Swarm Manager Install Docker on Ubuntu 18.04 Be sure to use the private IP (NOT the public IP) for the –advertise-addr: docker swarm init –advertise-addr <swarm manager private IP> This shows some basic information about the current status of the swarm: docker info List the current nodes in the …