Card 01/ 05

ConceptDifficulty: Beginner1 min

What a Container Shares With the Machine

You run your first container and the prompt comes back before you have finished reading the command. A virtual machine asked to do the same job spends a minute booting first.

bash
$ time docker run --rm alpine echo hello
hello

real	0m0.158s

Nothing booted. A container is an ordinary process on the kernel you are already running, started with its own view of the filesystem, its own process numbers and its own network interface.

What a container brings and what it borrows
LayerWhere it comes from
KernelThe host's, shared with every other container
FilesystemThe image
ProcessesIts own numbering, starting again at 1
NetworkIts own interface, attached to the host

This is why a container starts in milliseconds and why twenty of them fit on a laptop. There is only ever one kernel running.