Course map
Stage 1: Foundations
Stage 2: Data Integration
Stage 3: Building & Shipping
Stage 4: Customer Engagement
Stage 5: Specialization

Part 10 / Topic 3 of 6

Containers

A container image packages your app and its dependencies so the thing you tested is the thing that runs — the same image in staging and prod, byte for byte. A Dockerfile for the Part 9 service:

FROM python:3.14-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt   # cached layer: deps change rarely
COPY . .
USER nobody                                          # never run as root
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

What belongs in the image: code, dependencies, nothing else. What must never be in it: secrets, environment names, customer data — those are injected at runtime (docker run -e ACME_API_TOKEN=...), which is exactly why the config discipline from lessons 1–2 comes first. An image with a baked-in token is a secret leak with a version tag.

🧪 Quick quiz

  1. What does a container image give a customer deployment?
Show the answer

The same packaged app and dependencies in every environment. Configuration and secrets are still injected per environment at run time, not baked into the image.

Done here? The practice set for Part 10 — 4 exercises with solutions — is on the part page.

Search the guide