A hands-on, progressive learning path through Docker fundamentals, from basic images to full-stack multi-container applications with Docker Compose.
This repository contains 6 practical lessons, each building upon the previous one:
01_images - Your First Docker Image
Learn the basics of Docker images and containers with a simple Node.js web application.
- Writing your first Dockerfile
- Building images
- Running containers with port mapping
- Tech: Node.js, Express
02_interactive - Interactive Containers
Explore interactive containers that accept user input.
- Using
-itflags for interactive mode - Working with stdin/stdout in containers
- Tech: Python
03_volumes - Data Persistence
Master Docker volumes for persistent data and development workflows.
- Named volumes for data persistence
- Bind mounts for live code reloading
- Anonymous volumes for dependencies
- Tech: Node.js, Express
04_networking - Container Networking
Learn how containers communicate with each other and external services.
- Creating Docker networks
- Container-to-container communication
- External API calls from containers
- Tech: Node.js, MongoDB, Star Wars API
05_multicon - Multi-Container Apps (Manual)
Build a full-stack application with manually orchestrated containers.
- Setting up a 3-tier architecture
- Managing multiple containers manually
- Understanding inter-service communication
- Tech: React, Node.js, Express, MongoDB
06_compose - Docker Compose Orchestration
Simplify multi-container management with Docker Compose.
- Declarative multi-container setup
- Service dependencies
- Environment variable management
- Development workflows with hot reload
- Tech: React, Node.js, Express, MongoDB
- Docker installed on your machine (Get Docker)
- Basic command line knowledge
# Navigate to the basics
cd 01_images
# Build the image
docker build -t node-demo .
# Run the container
docker run -p 80:80 --rm node-demo
# Visit http://localhost in your browser# Navigate to the Docker Compose example
cd 06_compose
# Start all services (React frontend, Node.js backend, MongoDB)
docker-compose up
# Visit http://localhost:3000 in your browser
# Stop everything
docker-compose downI recommend following the lessons in order:
- Start with 01_images - Get comfortable with basic Docker concepts
- Progress through 02-04 - Learn about interactivity, volumes, and networking
- Tackle 05_multicon - See the complexity of manual orchestration
- Master 06_compose - Appreciate how Docker Compose simplifies everything
Each directory contains a complete, runnable example with its own Dockerfile(s) and source code.
# Build an image
docker build -t image-name .
# Run a container
docker run -p host-port:container-port image-name
# List running containers
docker ps
# Stop a container
docker stop container-name
# Remove a container
docker rm container-name
# List images
docker images
# Remove an image
docker rmi image-name# Start all services in detached mode
docker-compose up -d
# View logs
docker-compose logs -f
# Stop and remove containers
docker-compose down
# Stop and remove containers + volumes
docker-compose down -v
# Rebuild and start
docker-compose up --buildBy completing these lessons, you'll understand:
- ✅ How to containerize applications with Dockerfiles
- ✅ Image building and container lifecycle management
- ✅ Data persistence with volumes and bind mounts
- ✅ Container networking and inter-service communication
- ✅ Multi-container application architecture
- ✅ Docker Compose for orchestration
- ✅ Development workflows with hot reload
- ✅ Environment variable management
- ✅ Best practices for
.dockerignorefiles
The final lessons (05 & 06) implement a complete 3-tier architecture:
┌─────────────────────────────────────────────────────────┐
│ Frontend (React SPA) │
│ Port: 3000 │
│ - User interface for managing goals │
│ - Hot reload for development │
└─────────────────┬───────────────────────────────────────┘
│ HTTP Requests
↓
┌─────────────────────────────────────────────────────────┐
│ Backend (Node.js/Express API) │
│ Port: 80 │
│ - REST API endpoints: GET/POST /goals, DELETE /goals │
│ - Morgan logging │
│ - CORS enabled │
└─────────────────┬───────────────────────────────────────┘
│ MongoDB Protocol
↓
┌─────────────────────────────────────────────────────────┐
│ Database (MongoDB) │
│ Port: 27017 (internal) │
│ - Persistent data storage │
│ - Authentication enabled │
└─────────────────────────────────────────────────────────┘
- Experiment: Modify the code and Dockerfiles to see what happens
- Read the logs: Use
docker logsordocker-compose logsto debug - Clean up: Regularly remove unused containers and images to save space
- Compare 05 and 06: See how Docker Compose simplifies the same application
- Check the WARP.md: Contains detailed technical documentation for each lesson
- Volume paths in some examples may need adjustment for your system
- MongoDB credentials are hardcoded for learning purposes (never do this in production!)
- The React development server requires
stdin_openandttyflags .dockerignorefiles help keep your images lean by excluding unnecessary files
This is a personal learning repository, but suggestions and improvements are welcome!
Free to use for learning purposes.
Happy Dockerizing! 🐳