๐Ÿ“– Complete Visual Guide ยท Windows 11 Ready

What is Docker?

From school-student basics to production-grade deployments โ€” with interactive diagrams, use cases, and hands-on labs.

๐Ÿณ
01 ยท The Simple Version

Think of it like a Lunchbox

Before we get technical, let's use an analogy every student will get.

๐Ÿฑ

The Problem: "It works on my PC!"

You build an app on your laptop. It works perfectly. You give it to your friend โ€” it crashes. Why? Because their computer has different software, different versions, different settings.

๐Ÿ“ฆ

Docker = A Packaged Lunchbox

Docker lets you pack your app and everything it needs into one tidy box called a Container. The app runs the same everywhere โ€” your laptop, a server, the cloud.

๐Ÿšข

Why "Docker"?

Think of a shipping dock. Before containers, every cargo item was loaded differently. With shipping containers, one standard box fits every ship, truck, and train. Docker does the same for software.

One-liner definition: Docker is a tool that packages your application and all its dependencies into a lightweight, portable container that runs consistently anywhere.

Key Concepts

Three things to remember:

๐Ÿ–ผ๏ธ

Image

A read-only blueprint or recipe. Like a cookie cutter โ€” it defines what the container will look like but isn't running yet. Images are stored in registries like Docker Hub.

๐Ÿ“ฆ

Container

A running instance of an image. Like a cookie cut from the cutter โ€” now it exists, it's alive. You can have 100 containers from one image, all running independently.

๐Ÿ“„

Dockerfile

A simple text file with instructions to build your image. Like a recipe card: "Start with Ubuntu, install Python, copy my code, run this command."

02 ยท Architecture

How Docker Works

The full picture from your code to a running container.

๐Ÿ“„ Dockerfile
โ†’ build โ†’
๐Ÿ–ผ๏ธ Image
โ†’ run โ†’
๐Ÿ“ฆ Container
โ†’ push โ†’
โ˜๏ธ Registry (Docker Hub)
Your Machine
๐Ÿ“ฆ
Container A
App + Deps
๐Ÿ“ฆ
Container B
App + Deps
๐Ÿ“ฆ
Container C
App + Deps

Docker Engine (manages all containers)
โš™๏ธ
Docker Daemon
The background service
๐Ÿ–ผ๏ธ
Image Cache
Stored locally
โ˜๏ธ
Registry
Docker Hub / private

Operating System (Host OS โ€” shared kernel!)
๐Ÿง
Linux Kernel
Shared by all containers

๐Ÿ’ป
Physical Hardware
CPU ยท RAM ยท Disk
Key insight: Containers share the host OS kernel. This is why they are so much lighter and faster than Virtual Machines, which each carry their own full OS.
03 ยท Comparison

Docker vs Virtual Machines

Both isolate environments โ€” but in very different ways.

Virtual Machine Stack
๐Ÿ“ฆ
App A
๐Ÿ“ฆ
App B
Guest OS
(each VM has FULL OS)
Guest OS
(GBs of duplication)

Hypervisor (VMware / VirtualBox)

๐Ÿ’ป
Hardware
Docker Container Stack
๐Ÿ“ฆ
App A
+ only libs needed
๐Ÿ“ฆ
App B
+ only libs needed

Docker Engine

๐Ÿง
Host OS (shared kernel)

๐Ÿ’ป
Hardware
Feature ๐Ÿ–ฅ๏ธ Virtual Machine ๐Ÿณ Docker Container
SizeGBs per VMMBs per container
Boot timeMinutesSeconds or less
OS overheadFull OS per VMShared host kernel
IsolationVery strongProcess-level (less than VM)
PortabilityHarderVery easy (push/pull image)
Use case fitFull OS isolation, legacy appsMicroservices, CI/CD, dev env
04 ยท Real World

Where Docker is Used

Docker is everywhere in modern software development.

Dev Environment

๐Ÿง‘โ€๐Ÿ’ป Consistent Dev Setup

New team member joins. Instead of spending 2 days installing dependencies, they just run docker-compose up and the entire project is running in minutes โ€” database, backend, frontend, all of it.

CI/CD

โš™๏ธ Automated Testing & Deployment

Every time code is pushed to GitHub, a Docker container spins up, runs all tests in a clean environment, builds the app, and deploys โ€” all automatically and reproducibly.

Microservices

๐Ÿงฉ Breaking Apps Into Services

Netflix, Uber, and Amazon run hundreds of small services instead of one giant app. Each service runs in its own Docker container โ€” independently deployable, scalable, and maintainable.

Cloud

โ˜๏ธ Cloud Deployment

AWS, Azure, and Google Cloud all support Docker natively. Build once on your laptop, deploy the same container image to the cloud. No surprises โ€” it runs exactly the same.

ML / AI

๐Ÿค– Machine Learning Pipelines

Data scientists package models with their exact Python version, CUDA version, and library versions. The model trains the same on any GPU machine without environment conflicts.

Legacy

๐Ÿ“ฆ Running Legacy Apps

Have an old app that needs PHP 5.6 but your server runs PHP 8? Run the old app in a container with its exact environment without breaking anything else on the server.

05 ยท Hands-On Lab

Getting Started on Windows 11

Step-by-step from zero to your first running container.

1

Enable WSL2 (Windows Subsystem for Linux)

Docker Desktop for Windows requires WSL2. Open PowerShell as Administrator and run:

PowerShell โ€” Administrator
# Enable WSL and set version to 2
PS> wsl --install
Installing: Windows Subsystem for Linux
WSL installed successfully.
# After restart, verify WSL2 is default
PS> wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2

Restart your computer when prompted.

2

Install Docker Desktop

Download Docker Desktop from docker.com/products/docker-desktop. Run the installer and make sure "Use WSL 2 instead of Hyper-V" is checked during setup.

After installation: Launch Docker Desktop from the Start menu. Wait for the whale icon in the taskbar to stop animating โ€” that means Docker is ready.
3

Verify Installation

Open Windows Terminal or Command Prompt and verify Docker is working:

Windows Terminal
C:\> docker --version
Docker version 26.1.4, build 5650f9b
C:\> docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.

๐ŸŽ‰ If you see "Hello from Docker!" โ€” you're up and running!

4

Pull and Run Your First Real Container

Let's run an Nginx web server in seconds โ€” no installation needed:

Windows Terminal
# Pull the nginx image from Docker Hub
C:\> docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
Status: Downloaded newer image for nginx:latest
# Run nginx: -d background, -p map port 8080 to container's 80, name it "my-nginx"
C:\> docker run -d -p 8080:80 --name my-nginx nginx
a3f9d1e7c2b8...
# Visit http://localhost:8080 in your browser!
What happened? Docker pulled the nginx image (~50MB), created a container from it, and mapped your port 8080 to the container's port 80. Open http://localhost:8080 โ€” you'll see the Nginx welcome page!
5

Essential Container Commands

Container Management
# See all running containers
C:\> docker ps
# See all containers (including stopped)
C:\> docker ps -a
# Stop a container
C:\> docker stop my-nginx
# Start it back
C:\> docker start my-nginx
# View logs from a container
C:\> docker logs my-nginx
# Go inside a running container (bash shell)
C:\> docker exec -it my-nginx bash
# Remove a container (must be stopped first)
C:\> docker rm my-nginx
# List all images
C:\> docker images
6

Build Your Own Image with a Dockerfile

Let's create a simple Python web app and containerize it. Create a folder called myapp and these files:

app.py

app.py โ€” Python Flask App
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return "<h1>Hello from Docker! ๐Ÿณ</h1>"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)

requirements.txt

requirements.txt
flask==3.0.3

Dockerfile (no file extension!)

๐Ÿณ Dockerfile
# Start from official Python image
FROM python:3.12-slim
# Set working directory inside the container
WORKDIR /app
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY . .
# Tell Docker our app listens on port 5000
EXPOSE 5000
# Command to run when container starts
CMD ["python", "app.py"]

Now build and run it:

Windows Terminal โ€” inside myapp folder
# Build the image and tag it "myapp"
C:\myapp> docker build -t myapp .
[+] Building 12.3s (8/8) FINISHED
# Run it!
C:\myapp> docker run -d -p 5000:5000 --name myapp-container myapp
7fe2a4d1b...
# Open http://localhost:5000 ๐ŸŽ‰
06 ยท Multi-Container Apps

Docker Compose

Real apps have multiple parts โ€” a web server, a database, a cache. Docker Compose lets you define and run them all with a single file.

Analogy: If a Dockerfile is a recipe for one dish, docker-compose.yml is the full dinner menu โ€” it orchestrates multiple dishes (services) to work together.

Example: Python App + PostgreSQL + Redis

๐Ÿ“‹ docker-compose.yml
version: '3.9'
services:
# Our Flask web app
web:
build: .
ports:
- "5000:5000"
depends_on:
- db
- redis
environment:
DATABASE_URL: postgresql://user:pass@db:5432/mydb
# PostgreSQL database
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: pass
POSTGRES_DB: mydb
volumes:
- postgres_data:/var/lib/postgresql/data
# Redis cache
redis:
image: redis:alpine
volumes:
postgres_data:
Docker Compose Commands
# Start ALL services in the background
C:\myapp> docker-compose up -d
Creating network "myapp_default" with the default driver
Creating myapp_db_1 ... done
Creating myapp_redis_1 ... done
Creating myapp_web_1 ... done
# View logs of all services
C:\myapp> docker-compose logs -f
# Stop and remove all containers
C:\myapp> docker-compose down
07 ยท Reference

Docker Cheatsheet

The most important commands, organized by category.

๐Ÿ“ฆ Containers
docker run <image>Create and start a container
docker run -d ...Run in background (detached)
docker run -p 8080:80 ...Map host:container port
docker psList running containers
docker ps -aAll containers (incl. stopped)
docker stop <name>Gracefully stop container
docker rm <name>Delete a container
docker logs <name>View container logs
docker exec -it <name> shEnter running container
๐Ÿ–ผ๏ธ Images
docker pull <image>Download image from Hub
docker imagesList local images
docker build -t name .Build image from Dockerfile
docker rmi <image>Delete an image
docker push name:tagPush to Docker Hub
docker tag img name:tagTag an image
docker history <image>Show image layers
๐Ÿ”ง Docker Compose
docker-compose upStart all services
docker-compose up -dStart in background
docker-compose downStop & remove containers
docker-compose psList compose services
docker-compose logs -fStream logs
docker-compose buildRebuild images
docker-compose restartRestart all services
๐Ÿงน Cleanup
docker system pruneRemove all unused data
docker container pruneRemove stopped containers
docker image pruneRemove dangling images
docker volume pruneRemove unused volumes
docker statsLive resource usage
docker inspect <name>Full container details (JSON)

Dockerfile Instructions Reference

๐Ÿ“„ Dockerfile Keywords
FROM <image>Base image to start from
WORKDIR /pathSet working directory
COPY src dstCopy files into image
ADD src dstLike COPY, also handles URLs & tarballs
RUN <command>Execute during build
CMD ["cmd","arg"]Default command at startup
ENTRYPOINT [...]Non-overridable startup command
EXPOSE <port>Document which port app uses
ENV KEY=VALUESet environment variable
ARG NAME=defaultBuild-time variable
VOLUME /pathDeclare persistent mount point