AlgoViz

Docker

easy 26 min

Docker packages a program with its files into an image and runs it as an isolated process called a container.

When it comes up

The moments this idea belongs in a design interview, and the moments it does not.

Signals

When it comes up

You hearSayBecause
Works here, not thereOne image through all environmentsThe same bytes everywhere
Many small servicesContainers, then an orchestratorOwn dependencies, dense packing
Builds take ten minutesOrder layers, cache, multi-stageOnly changed steps run
Run customers' codeMicroVMs around itA shared kernel is a thin wall
Keep the uploadsObject storage or a volumeThe writable layer is temporary
Deploy in secondsSmall images, shared layersOnly missing layers travel

Options

Explain your choices

Twelve services must run in production. What runs the containers?

Breaksdocker run on one big server
How
A script starts all twelve.
Limit
One host is one failure, and nobody replaces a hung container or rolls out gradually.
Choose when
A demo.
WorksCompose on two hosts behind a load balancer
How
The same file on both, deployed one after the other.
Limit
No automatic healing between hosts, manual capacity, state needs its own plan.
Choose when
A small team with steady load.
StrongA managed orchestrator
How
A managed Kubernetes or container service with health checks, rolling updates and limits; databases outside.
Limit
More concepts and cost; someone must own it.
Choose when
Several teams, changing load, an availability target.