What Is Docker and Why It Matters
The "works on my machine" problem — and the container that solves it permanently
Docker solves the oldest problem in software deployment: your app works perfectly in development, then breaks in production because the server has a different Node version, different environment variables, or different system libraries. Containers package your app with everything it needs — code, runtime, dependencies — so it runs identically everywhere.
The "works on my machine" problem
A Docker container is a shipping container for software
Before standardised shipping containers, loading a cargo ship was chaotic — every item was a different shape and required custom handling. After containers, every ship, port, and truck used the same standard box. Docker does the same for software: your app is packaged into a standard container that runs on any machine with Docker installed, whether that machine is your laptop, a CI server, or a Fly.io instance in Frankfurt.
Containers vs virtual machines
- Virtual machines — Emulate an entire computer including hardware. Heavy, slow to start (minutes), use gigabytes of RAM even when idle.
- Containers — Share the host OS kernel. Lightweight, start in seconds, use megabytes. A typical Next.js container starts in under 2 seconds.
- The tradeoff — VMs offer stronger isolation (different OS). Containers offer better performance and developer experience. For most web apps, containers are the right choice.
What Docker actually consists of
- Docker Engine — The daemon running on your machine that manages containers. Installed once, runs in the background.
- Dockerfile — A text file with instructions for building your container image. Think of it as a recipe.
- Image — The built output of a Dockerfile. Immutable, versioned, shareable. This is what gets deployed.
- Container — A running instance of an image. You can run many containers from one image.
- Registry — A storage service for images. Docker Hub is the public registry. Fly.io and Railway have their own internal registries.
Install Docker Desktop
Download Docker Desktop from docker.com — it includes the Docker Engine, CLI, and a GUI dashboard. On Mac and Windows it manages a lightweight Linux VM automatically. You do not need to think about the VM.
Try this
Install Docker Desktop. Once running, open a terminal and run `docker run hello-world`. Docker will pull the hello-world image from Docker Hub and run it. Read the output — it explains exactly what just happened step by step. This is your first container.