A while ago I was working on a Django project with a frontend developer. He cloned the repo, ran the setup, and immediately hit errors. Python version mismatch. Wrong pip packages. It took an hour to sort out his environment before we could actually work together.

Docker fixes this. Here’s how.

The problem

Modern projects have dependencies. Not just your Python packages — the Python version itself, system libraries, the database version, the cache layer. Getting all of that to match across machines, across team members, across staging and production, is genuinely hard.

The classic symptom: “it works on my machine.”

What Docker gives you

Docker packages your application and everything it needs to run into a single unit — a container. The container runs the same way on any machine that has Docker installed. No version conflicts. No setup docs that go stale. No “it works on my machine.”

Three concepts to understand:

  • Dockerfile — a text file with instructions for building your environment
  • Image — the built result of a Dockerfile; a template
  • Container — a running instance of an image; the actual process

A simple Dockerfile

FROM ubuntu:20.04

RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    nginx \
    default-mysql-client

COPY requirements.txt .
RUN pip3 install -r requirements.txt

COPY . /app
WORKDIR /app

Build and run

# Build an image called my-django-app
docker build -t my-django-app .

# Run it, mapping port 8000
docker run my-django-app -p 8000:8000

That’s it. Anyone with Docker can now run your project with two commands.

Why this matters

The frontend developer I mentioned? If we had Docker set up, he would have run docker compose up and been working in two minutes instead of an hour. No Python version issues. No pip conflicts. Everything already configured.

This is especially important when you have a team, when you’re deploying to cloud infrastructure, or when you want staging and production to behave identically. Which, if you’ve ever debugged a “works in staging, broken in prod” issue, you know is very important.

Docker is not complicated. The concepts are simple. Start with a Dockerfile for your next project and see how much easier handoffs become.