Part 12 — Containers
Like CI/CD, Docker isn't a standalone app — it's infrastructure you add to an
existing project. Take the Freelancer Client Portal or Splitwise Lite and
containerize it. The goal is "anyone can clone this repo and run
docker compose up and the entire app works" — no installing Node,
no configuring MongoDB, no environment setup.
A docker-compose setup that runs your full stack app in containers: React frontend served by nginx, Express backend, and MongoDB. One command starts everything. Create both a production config and a development config with hot reload.
docker-compose.yml (production): three services — frontend, backend, mongodocker-compose.dev.yml (development): bind mounts for hot reload on both frontend and backend.dockerignore files for both services (exclude node_modules, .git, etc.)localhost anymore — containers have their own network. It needs the
service name from docker-compose (e.g., mongo) as the hostname. The
frontend's API calls also break because the browser isn't inside the container —
http://backend:3001 means nothing to the user's browser. That's why
you need nginx as a reverse proxy: the browser hits nginx, nginx forwards /api
requests to the backend container internally. Understanding this distinction between
"container-to-container" and "browser-to-container" networking is the core lesson.