Docker for Dummies

A no-nonsense intro to what Docker actually is and why everyone keeps talking about it.

"Types of Headaches" diagram comparing migraine, hypertension and stress, with Docker colouring the entire head red

"It works on my machine" is easily the biggest lie in software.

You've been there. Code runs beautifully on your local setup, hits the server, and everything is cooked. Missing dependencies, wrong library versions, some system path that doesn't exist. You spend two hours debugging something that was never your bug.

Why? Environments are messy. Different OS versions, different package managers, different CPU architectures. Every machine is a unique snowflake and that's a problem when you're trying to ship software.

Docker was built to kill this excuse for good.


What in the World is Docker?

At its core, Docker takes your app, wraps it with everything it needs to run, and ships it inside a container. Same container, every machine, every time.

Let's break it down with two examples.


Analogy 1 - The Recipe Book

Think of Docker like baking:


Analogy 2 - Walter White's Mobile Home

Breaking Bad RV parked in the woods, captioned "every RV looks like a meth lab"

Breaking Bad viewers get this immediately:

Walter never cooked at home. He took the RV, did his thing, and if it got busted he didn't waste time fixing it. Just spun up a fresh one from the blueprint and got back to work.

(Secrets like database passwords or API keys are the exception. You wouldn't print them in the cookbook or leave them in the RV. Inject them at runtime, never bake them into the image.)


Containers vs. Virtual Machines

Chris Pratt shrugging, captioned "I don't know how a Docker container is different from a VM, and at this point I'm too afraid to ask"

People confuse containers with VMs. They're not the same. I'll skim over it here but it deserves its own post, and it has one.

The OG problem with VMs was bloat. One VM per service meant multi-minute startup times, massive storage overhead, and resource usage that rarely made sense. But cramming multiple services into a single VM led to conflicts and everyone lost.

That kernel-sharing is why a single server can run tens of containers across multiple services with way less overhead than the VM era.


The Big Three in Action

You only need three things to build anything with Docker.

1. The Dockerfile

The blueprint.

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]

2. The Image

The read-only snapshot of your app and everything it needs. Built in layers. If two images share a base like python:3.11-slim, that base is stored once and reused. Picking the right base image matters a lot for size and security, that's in Production Docker.

docker build -t my-app .

Once built, this runs the same on your laptop, your teammate's machine, or a Fargate task on AWS. As long as there's a Docker-compatible runtime around, it just works.

3. The Container

The actual running app.

docker run my-app

The loop is simple: Write the Dockerfile -> Build the Image -> Run the Container.


When to use it (and when to skip)

Once you've got the basics, VMs vs. Containers is the natural next read. It explains why containers work the way they do, not just what they are.

Drake meme rejecting download, install and troubleshoot, and approving "use Docker!"

Docker won't fix bad code. But it makes sure that if it works on your machine, it works everywhere else too.

Docker for Dummies | dmix writes