Post on 22-Jan-2018
DOCKER SWARM
An introduction
Matthias Noback
@matthiasnoback
info@matthiasnoback.nl
some-other-machine
DOCKERA daemon and a client
Docker daemon
client
container container container
SWARMNodes running a Docker daemon "in Swarm mode"
Swarm
Node Node Node
CLI TOOLSdocker-machine and docker
CLUSTER MANAGEMENTEasily add new nodes to a cluster
CONFIGURATIONDocker Compose file (some keys are ignored)
# docker-compose.yml
version: '3'
services: ...
SCALINGConfigure the number of tasks (replicas)
Service (recipe)
Service_Task_1 Service_Task_2
SERVICE DISCOVERY & LOAD BALANCING
Divide incoming requests over available tasks
Service_Task_1:80
(10.0.0.23)
Service_Task_2:80
(10.0.0.24)
service:80
Host 1
MULTI-HOST NETWORKINGSecure, even across data centers
Node Node
Host 2
Node Node
Swarm
NODESNo login required
Use docker-machine to provision them
Use docker to deploy to them
MANAGERS AND WORKERSResilient
Manager
Worker Worker
Manager
Worker
CLOSING NOTES
Considerations
EVERYTHING IS AWESOME
STATEAim for stateless services
STATEFUL SERVICESDon't persist state on the host
Use a "volume scheduler" REX-Ray
STATEFUL SERVICESUse shared state (database)
Maybe use hosted solutions
STATEFUL SERVICESOr: use replication
DISPOSABLE INFRASTRUCTUREMake all setup automated
https://leanpub.com/the-devops-2-1-toolkit
https://leanpub.com/microservices-for-everyone/
https://training.matthiasnoback.nl/