Why containers: from bare metal to VMs to containers
Select an icon to see what it is.
Step 6 of 6
What you gain and what you give up
You gain portability, light isolation and fast scaling: many containers fit on one host. You give up some isolation, because all containers share one kernel, which makes a kernel bug more serious than in a VM. Linux containers also need a Linux kernel, which is why Docker Desktop runs a small Linux VM on macOS and Windows.
PrevNext
VM or container?
VM: own kernel, stronger isolation, heaviercontainer: shared kernel, light and fast, isolation by namespaces and cgroupsthey combine: containers often run inside VMs in the cloud
Try it yourself
Check that a container shares the host's kernel and ignores the host's Python. On Docker Desktop, the kernel shown is the one in Docker's Linux VM.
$ uname -r$ docker run --rm alpine uname -r$ python3 --version$ docker run --rm python:3.10-slim python --version$ docker run --rm python:3.12-slim python --version