What you will learn
- Explain namespaces and cgroups
- Compare containers and VMs
- Know when to use each
New to this? Start here
The basics, in plain English
A container is a lightweight, sealed box that holds an app plus everything it needs to run. Because it carries its own setup, it runs the same on your laptop, a teammate’s machine, and a server. This fixes the classic “it works on my machine” problem.
- Container
- A self-contained package with your app and all its dependencies, ready to run anywhere.
- Image
- The frozen blueprint a container is started from, like a template.
- Docker
- The most popular tool for building and running containers.
- Virtual machine (VM)
- An older, heavier way to isolate apps that includes a whole operating system.
- Container vs VM
- Containers share the host’s OS so they are tiny and fast; VMs each carry a full OS so they are bulky.
- “Works on my machine”
- The bug where code runs for you but not others. Containers solve it by shipping the environment too.
01
Process isolation
A container is an isolated process using Linux namespaces and cgroups, sharing the host kernel. A VM virtualizes hardware and runs a full OS. Containers are lighter and faster.
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.