Your colleague can't run your code. Here's why.
Docker · Karar Dev ·
You’re building a Django API. Python 3.11 is installed, your package versions are pinned in requirements.txt, PostgreSQL runs locally. Everything works.
You push to GitHub. Your colleague pulls it, runs it, and gets errors straight away. A different Python version. A different OS. A missing system library. PostgreSQL set up another way.
What Docker does
Docker packs your app together with everything it needs into one unit, called a container. You run that container anywhere, and it behaves exactly the same.
Three ideas, and you’re ready to start.
1. Image and container
An image is a blueprint. It’s static: it only describes what your environment should look like.
A container is a running copy of that image.
You build images. You run containers.
2. Dockerfile
A Dockerfile is a text file that tells Docker how to build your image, step by step. Start from this base. Install these packages. Copy these files. Run this command.
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
3. Docker Compose
Docker Compose lets you describe your whole stack in one file: your API, your database, your Redis. Then you run all of it together with one command.
services:
api:
build: .
ports: ["8000:8000"]
depends_on: [db]
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: example
docker compose up
This is what makes Docker actually practical for backend work. Your colleague doesn’t install Python or PostgreSQL. They run one command and get the same stack you have.
That’s it
Image, Dockerfile, Compose. Everything else builds on top of these three.
I also made a short video on Docker and Docker Compose basics. Watch it on LinkedIn.
Looking for a developer, or have a project?
You're in the right place.