Getting Started with Docker Swarm Mode

WHY MULTIPLE CONTAINER HOSTS?

By scmGalaxy.com

About Me

DevOps@RajeshKumar.XYZ

Single Machine

single-machine

Single Machine

single-machine1

Single Machine

single-machine2

Machine

machine

cluster

cluster

cluster

cluster1
cluster2
cluster3
cluster4
cluster5
api
customer api

Creating a Swarm and Running a Service

Service

service

A service is a definition

Service

service1

the swarm manager accepts your service definitionas the desired statefor your application

Adding Nodes

Ingress Routing and Publishing Ports

cust api

Publish to Host Instead of Swarm

cadvisor

Reconciling a Desired State

Rolling Updates

rolling update
rolling1 update
rolling2 update
rolling3 update
rolling4 update

--update-parallelism 2

--update-delay 10s

rolling5 update

Container to Container Networking

container
container networking1
container networking2
container networking3

Deploying with Stacks

stack

dockerservice create --name viz\
	--publish 8090:8080 \
	--mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock\
	--constraint=node.role==manager \
        manomarks/visualizer


version: 3.1
services:
     viz:
       image: mano.arks/visualizer
       volumes:
          — “/var!run/docker.sock:/var/run/docker.sock”
       deploy:
          placement:
             constraints:
                — node. role.anager
					

docker network create -d overlay --subnet1O.O.9.O/24 backend

docker service create --name balance \
	-p 5000:3000 \
	--env MYWEBCUSTOMER_APlcustomer:3OOO \
	--network backend \
        swarmgs/balance
docker service create --name customer \
	--network backend \
    swarmas/customer

		version: 3.1’
		
		services:
		  customer:
		      image: swarmgs/customer
		  balance:
		      image: swarmgs/balance
		      ports:
		         — “5000:3000”
		   environment:
		       MYWEB_CUSTOMER_API: “customer: 3000”
				
					

Health Checking

Protecting Secrets

steps

1. Create secret

-Password, SSH key, certificates

-<= 500 KB

-Swarm only

-Storage: encrypted, replicated Raft log

-STDIN or file

-Define in compose stack file

2. Grant access to service

-dockerservice create –secret X

-stack compose file –secrets section

3. App reads secret from /run/secrets/X

-in-memory filesystem

steps

questions?

questions

THANKS!!!