A lean, practical Docker course — run containers, write a Dockerfile for your app, build small and secure images, persist data with volumes, network containers together, push to a registry, and run your whole stack with Docker Compose. Every lesson is commands and files you run.
Docker runs and is driven from the command line, so you need shell comfort and a little Linux. The hands-on example containerizes a Node app, so basic Node helps but is not essential — you can follow every command as written.
Before you start
Install Docker, then confirm it runs. Pick your OS:
Windows
Install Docker Desktop, restart your PC, launch it once, and wait until the tray icon reports running.
winget install Docker.DockerDesktopmacOS
Install Docker Desktop, then launch it and wait until it reports running.
brew install --cask dockerLinux
Install Docker Engine with the official script. On Linux you run docker with sudo (or add yourself to the docker group).
curl -fsSL https://get.docker.com | shRunning Your First Containers
Run, list, inspect, and remove containers from the CLI — start a throwaway container, run a real PostgreSQL in the background, read its logs, and open a shell inside it.
Writing a Dockerfile
Package your own app into an image — write a Dockerfile for a Node app step by step, build it with docker build, run it, and keep junk out of the image with a .dockerignore.
Smaller, Faster, Safer Images
Make images build fast and ship small — order your layers so dependency installs are cached, use a multi-stage build to drop build tools, and run as a non-root user.
Persisting Data: Volumes & Bind Mounts
A container's filesystem is thrown away when it is removed. Keep data with named volumes, mount your source code with a bind mount for live development, and clean volumes up.
Networking Containers
Let containers talk to each other and to you — put containers on a user-defined network so they reach each other by name, and understand publishing ports versus internal ports.
Pushing to a Registry
Share your image so a server can run it — log in to a registry, tag your image with your username and a version, push it to Docker Hub, and pull it back anywhere.
Docker Compose
Run your whole stack with one command — describe an app plus its database in a compose.yaml, bring it all up with docker compose up, and wire in volumes, networks, and live-reload.