Swarm, the comic

The kitchen that keeps cooking.

Swarm is part of the Docker Engine you already run, and new to a lot of people who use Docker every day. So here it is as a story: a restaurant, a head chef, and a cook who always goes home at nine.

1 The old way

This is you. You run a small restaurant with one cook, Cas, and you tell Cas exactly what to make.
Three pizzas,please!Comingright up!
It works fine. Until nine in the evening, when Cas puts on a coat and goes home.
Nine o'clock.See you tomorrow!
Nobody makes new pizzas. Cas was the whole kitchen, and there is nobody else to take over.
??Where'smy pizza?Uh…

2 Enter the head chef

So you hire a head chef and a few more cooks. The chef is the manager, the cooks are the workers, and the whole kitchen together is the swarm.
managerworkerworkerworkerMorning,team!Morning,chef!
You don't tell a cook what to do any more. You tell the chef what you want, and the chef keeps it that way. That order is a service.
I want three pizzason the pass.Always.Leave itto me.
The chef decides who makes them. Each pizza is a task, and the chef spreads the tasks over the cooks.
One for you,one for you,and one for you.

3 When a cook goes home

Nine in the evening again. Cas goes home, and the pizza Cas was making goes too.
Nine o'clock,I'm off!
The chef sees a pizza missing and has another cook make it. You did not lift a finger: that is the whole point of a swarm.
Ben+1Ben, takethat one too.On it,chef!
Need a cook to step away, for a break or a repair? Put them on drain. The chef moves their work to the other cooks first.
Take your break.Your pizza iswith Ben now.Thanks,chef!

4 What the chef hands out

The secret sauce recipe travels in a sealed envelope. Only the cooks who need it get one, and it is never pinned on the wall. That is a secret: a password, say, that the swarm keeps encrypted.
The sauce recipe.For your eyes only.My lipsare sealed.
The menu card is no secret, but every station needs the same one. That is a config: the chef hands out a copy wherever a cook ends up working.
Same menueverywhere.
A set menu is a few dishes that come out together. In a swarm that is a stack: services that belong together, like a compose project.
The set menufor table four!Starter, main,dessert. Together.

5 Running the kitchen

A new cook gets in with a token: one kind for cooks, another for chefs. Anyone holding one can walk in, so if a token leaks, the chef prints a new one.
newI've got aworker token.Then comeon in!
Chefs decide by majority. With two, one going home leaves no majority, and nobody can change the orders. So have one chef, three or five. Never two or four.
The other chefwent home. I can'tdecide alone!We'll finishwhat's ordered.
At night you can lock the kitchen: that is autolock. After a restart, a chef needs the key before taking orders again. Keep that key somewhere safe.
Key first,then cooking.

6 Do you need one?

A laptop and one home server? One cook with a good recipe is plenty. That recipe is compose.
Just the twoof us, then.Easy.
Two servers or more, and things must keep running when one of them goes home? That is when a kitchen with a head chef pays off.
Nobodypanics.Bye!
In Docker Client MX, the Swarm page opens on the Overview: who is in charge, how many cooks there are, and the tokens to let a new one in.
THE END

The cheat sheet

Every picture above, in swarm words.

You, the owner
You, giving the orders
The head chef
A manager node
A cook
A worker node
The whole kitchen
The swarm
“Three pizzas, always”
A service with three replicas
One pizza
A task
A cook on a break
A node on drain
The sealed envelope
A secret
The menu card
A config
A set menu
A stack
The ticket at the back door
A join token
The lock on the kitchen
Autolock
Now run the kitchen yourself.
The Swarm page shows services, nodes, secrets and configs, and helps you start a swarm on your own servers.