TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to Docker and containers

๐Ÿ“ฆ Docker and containers: cheat sheet

๐ŸŽจ The analogyShipping containers: pack the thing and everything it needs into one standard box that every ship handles the same way.
๐ŸŽ“ The regular explanationPackaging an app with everything it needs (runtime, libraries, config) into an image that runs the same everywhere as an isolated container sharing the host's kernel.
It works on my machineStep 3 of 3
๐Ÿง‘โ€๐Ÿ”งYour workshopJava 21 โœ“๐ŸšขShip AJava 17 โœ—โ›ด๏ธShip Bmissing lib โœ—
  1. You build something in your workshop. It works perfectly there, with your tools and your parts.
  2. You send loose parts to two ships. One has different tools on board, so it can't put it together.
  3. The other ship differs in some small way you didn't notice. Each ship is a surprise.
Pack it in a containerStep 3 of 3
๐Ÿง‘โ€๐Ÿ”งYour workshopimage v1.4๐Ÿ—๏ธ Container yard๐ŸšขShip Aruns โœ“โ›ด๏ธShip Bruns โœ“
  1. You pack the thing and everything it needs, tools and parts included, into one standard shipping container.
  2. The container goes to the yard, where anyone can collect an identical copy.
  3. Every ship carries the same box the same way. Whatever's inside, it works the same on every ship.
Many boxes on one shipStep 3 of 3
๐Ÿšข One ship๐Ÿ“ฆBox 1own files๐Ÿ“ฆBox 2max 512 MB๐Ÿ“ฆBox 3own files๐ŸšขThe ship's hull
  1. One ship carries many boxes. Each box has its own contents, and none can see into the others.
  2. All the boxes share the one hull, which is why they're light and quick to load compared with sending a whole ship each.
  3. Each box is only allowed so much space and weight, so one heavy box can't sink the others.

๐Ÿงฉ Key questions

Why did the loose parts work in your workshop but not on every ship?
Each ship had different tools, or was missing a part you didn't know you needed. Every ship was a surprise, because the thing didn't travel with what it needs.
What goes into the standard shipping container?
The thing and everything it needs. Any ship can collect an identical copy and carry it the same way.
Why are many boxes on one ship lighter than a ship each?
Because they share one hull, while staying shut off from each other. None can see into the others, and each has a weight limit.