DevOps@RajeshKumar.XYZ
the swarm manager accepts your service definitionas the desired statefor your application
--update-parallelism 2
--update-delay 10s
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”
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