Module 1 · Images, Containers and WSL · Lesson 1 of 30
The problem Docker solves
The problem Docker solves
Without containers, a developer machine accumulates SDKs, database servers, Redis, RabbitMQ, Node versions, and OS-level dependencies. Two developers can run the same code and get different results because their machines differ. Docker moves most of that environment into versioned artifacts.
Without Docker vs with Docker
| Without Docker | With Docker |
|---|---|
| Install Postgres locally, manage service/version | Run postgres:18-alpine as a disposable container |
| Install Redis locally | Run redis:7-alpine and remove it when done |
| "Works on my machine" risk | Image captures runtime + dependencies |
| Manual onboarding document | compose.yaml can start the whole local stack |
| Multiple app versions conflict | Separate containers isolate processes and filesystems |
The lifecycle you should memorize
- Get/build an image
docker pull nginx:alpine # or docker build -t my-api:1.0 .
- Create + start a container from the image
docker run -d --name my-api -p 8080:8080 my-api:1.0
- Observe/debug it
docker ps docker logs -f my-api docker inspect my-api
- Stop/start the same container
docker stop my-api docker start my-api
- Remove the container
docker rm -f my-api
Containers vs virtual machines
A virtual machine virtualizes hardware and normally runs a complete guest operating system with its own kernel. A Linux container isolates processes using Linux kernel features while sharing the container host's kernel. That is why containers usually start faster and consume less overhead than full VMs.
| Topic | Container | Virtual machine |
|---|---|---|
| Isolation | Process/filesystem/network isolation | Hardware-level virtualization + guest OS |
| Kernel | Shares host/container-host kernel | Own guest kernel |
| Startup | Usually seconds or less | Usually slower |
| Image size | Often MBs to low GBs | Often multiple GBs |
| Best fit | Apps, APIs, workers, dependencies | Full OS isolation, different kernels, legacy workloads |
Windows nuance: Linux containers on Windows do not share the Windows kernel. Docker Desktop commonly uses a WSL 2 based Linux environment under the hood. Your containers still see a Linux kernel even though you launch docker commands from PowerShell.
Core Docker vocabulary
| Term | Meaning | Developer analogy |
|---|---|---|
| Dockerfile | Text recipe used to build an image | Build recipe / deployment recipe |
| Image | Read-only layered filesystem + metadata | Versioned application package |
| Container | Running/stopped instance created from an image | Process instance + isolated filesystem/network |
| Registry | Server that stores images | NuGet feed for container images |
| Docker Hub | Popular public/private registry | Public package registry |
| Tag | Human-readable image version label | 1.0, dev, commit SHA |
| Layer | Cached immutable filesystem change | Reusable build cache chunk |
| Volume | Docker-managed persistent storage | Managed data disk |
| Bind mount | Host path mounted into container | Shared host folder |
| Network | Virtual network for containers | Private app network / DNS domain |
| Compose | Declarative multi-container definition | Local stack manifest |