Cloud, deployment & production

Containerize an application with Docker

Write Dockerfiles, compose services, manage env/secrets, publish images.

~8 focused hours·beginner

Tools: Docker, Dockerfile, docker compose, Docker Hub/GHCR, .dockerignore

Market relevance — share of job ads asking for this
What employers mean

You should be able to…

  1. Write a Dockerfile for a Python API with a small final image (multi-stage build)
  2. Manage secrets/env vars for a container without baking them into the image
  3. Use docker compose to run an API plus its database/cache locally
  4. Debug a container that starts but the app inside crashes or can't reach a dependency
  5. Publish an image to a registry (Docker Hub/GHCR) with a versioned tag
  6. Reduce image size and build time with layer caching and .dockerignore
  7. Run a container as a non-root user for security

Needs first: Build and consume REST APIs

Learn — free, link-checked

The few resources that matter

Read · beginner · 40 min · docs.docker.com

Containerize a Python application

A Python-specific walkthrough for the exact Dockerfile patterns (deps, layers, entrypoint) you'll use to containerize an AI service. — Docker
Read · beginner · 45 min · docs.docker.com

Docker - Get Started

The official on-ramp: build, run and push your first image using Docker's own guided path. — Docker
Watch · beginner · 180 min · youtube.com

Docker Tutorial for Beginners [FULL COURSE in 3 Hours]

The most-watched free Docker course; explains images, volumes and networking with diagrams, not just commands. — TechWorld with Nana
Read · intermediate · 25 min · docs.docker.com

Dockerfile best practices

Multi-stage builds, layer caching and running as non-root — the difference between a Dockerfile that works and one that's production- and security-ready. — Docker
Watch · intermediate · 45 min · youtube.com

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

Walks through building, testing and pushing a Docker image on merge — the actual pipeline shape most AI-service repos use. — TechWorld with Nana
Practice

Containerized RAG API with Compose Stack

Take the FastAPI ticket/RAG service from an earlier project and containerize it with a multi-stage Dockerfile (small final image, non-root user), then write a docker-compose.yml that brings up the API alongside a Postgres and Redis container with env-based config. Publish the image to GitHub Container Registry.

Done when
  • Multi-stage Dockerfile produces a final image under 300MB and runs as a non-root user
  • `docker compose up` starts API + Postgres + Redis and the API can reach both
  • Secrets (DB password, API keys) are passed via env vars/`.env`, never hardcoded in the image
  • Image is pushed to a public registry with a semver tag and pullable by anyone
Prove it

Evidence a recruiter can check

  • Dockerfile and docker-compose.yml in a public GitHub repo
  • Public registry link (GHCR/Docker Hub) to the pushed image with tags
  • `docker images` output or README note showing final image size
Interview

Questions you'll get asked

  1. Walk me through a multi-stage Dockerfile for a Python FastAPI app.
  2. How do you pass secrets to a container without committing them to the image?
  3. Your container works locally but crashes in prod — how do you debug it?
  4. What's the difference between `CMD` and `ENTRYPOINT`?
  5. How would you use docker compose to run an API with a Postgres and Redis dependency?
  6. Why would you run a container as a non-root user, and how do you set that up?
  7. How do you keep a Python image small without breaking pip installs that need build tools?
See where you stand for Machine Learning Engineer