"Works on my machine." That legendary sentence has ruined millions of developer workdays — and Docker is the tool built so you never have to say it again.
"Works on my machine" — the problem Docker solves
An app that runs perfectly on your laptop can suddenly break on a teammate's laptop or on a server. The cause is almost always the same: a different environment — another Node/Python version, a missing system library, different OS configuration.
A container solves this by packaging your app together with everything it needs — runtime, libraries, configuration — into one unit that runs exactly the same on any machine.
Docker is the most popular platform for building and running containers: you describe your app's environment once, and everyone (and every server) runs an identical copy.
Containers vs Virtual Machines — a different level of isolation
If you've used VirtualBox/VMware before, it's natural to assume a container is a "mini VM". It actually works at a different level:
flowchart LR
subgraph VM["Virtual Machine"]
direction TB
A1["App"] --> G1["Full guest OS (GBs)"] --> HV["Hypervisor"] --> HW1["Host OS + Hardware"]
end
subgraph CT["Container"]
direction TB
A2["App + dependencies (MBs)"] --> DE["Docker Engine"] --> HW2["Host OS + Hardware"]
end
| Container | Virtual Machine | |
|---|---|---|
| What it carries | App + dependencies only | App + an entire guest OS |
| Typical size | Tens–hundreds of MB | Several GB |
| Startup time | Seconds | Minutes |
| Isolation | Process level, shares the host kernel | Hardware level, own kernel |
| Fits on 1 laptop | Dozens of containers | A handful of VMs |
What's actually shared: the kernel
Containers don't carry their own OS. Every container on a machine uses the same host kernel — Docker only isolates each container's processes, filesystem, and network (via Linux features called namespaces and cgroups; knowing the names is enough for now).
Because there's no guest OS to boot, containers are light and fast: they start in seconds, and one laptop can comfortably run dozens of them at once.
Why developers use Docker every day
- Try software without installing it — need PostgreSQL for an experiment? One command and it's running; when you're done, remove it without leaving a trace on your system.
- Consistent environments — the same code runs identically on your laptop, a teammate's laptop, CI, and production.
- Instant onboarding — a new team member clones the repo and runs one command, instead of losing half a day installing dependencies.
- The foundation of modern deployment — nearly every cloud and CI/CD platform today is container-based.
Summary
- The problem it solves: "works on my machine" — environments that differ between machines.
- A container = a package holding your app + all its dependencies, running identically anywhere.
- Container ≠ VM: containers share the host kernel (light, start in seconds); VMs carry a full OS (heavy, start in minutes).
- Docker = the most popular platform for building & running containers.
Next, we untangle the three words that confuse beginners the most: image, container, and registry.