Docker Tutorial
Learn Docker from scratch: containers, images, Dockerfiles, Docker Compose, networking, volumes, and multi-stage builds with hands-on examples.
40 lessons in this tutorial
Introduction to Docker
What Docker is and the problem it solves. Images versus containers, how containers differ from virtual machines, the core workflow, and when not to use it.
Why Use Docker?
The real benefits of Docker, consistency, isolation, portability and efficiency, with use cases across development, microservices and CI/CD.
Docker vs Virtual Machines
How containers and VMs really differ. Shared kernel vs hypervisor, startup time and density, isolation strength, when to use each, and why both together is normal.
Installing Docker
Which Docker to install on Windows, macOS or Linux, whether Docker Desktop's licence applies to you, and the three failures that hit almost everyone.
Installing Docker on Windows
Install Docker Desktop with the WSL 2 backend. Enabling virtualisation, the filesystem choice that makes builds ten times faster, and fixing startup errors.
Installing Docker on macOS
Install Docker Desktop on Intel or Apple Silicon, fix arm64 images that fail on amd64 servers, speed up bind mounts, and know the free alternatives.
Installing Docker on Linux
Install Docker Engine from the official repository on Ubuntu, Debian, RHEL and Fedora, plus the post-install steps that stop you needing sudo.
Key Docker Concepts
The Docker object model in one page. Image, container, layer, Dockerfile, registry, volume, network and Compose, and how they fit together.
Docker Images
How Docker images work. Layers and build cache, why deleting files does not shrink an image, tags vs digests, reducing image size, and clearing dangling images.
Image Naming & Tags
Learn how Docker images are named, versioned, and organized using registries, repositories, and tags.
Docker Hub
Explore Docker Hub - the world's largest container image registry. Learn to search, pull, and understand official images.
Docker Pull & Search
Learn how to pull Docker images from Docker Hub and search for the right ones using the CLI.
List & Inspect Images
Learn how to view, filter, and inspect Docker images on your local system to understand their contents and metadata.
Building Images
Learn to write Dockerfiles and use docker build to create custom images tailored to your applications.
Layers & Caching
Understand how Docker's layer system works and how to use build caching to make your builds dramatically faster.
Multi-Stage Builds
Use multi-stage builds to create lean, secure production images by separating build-time and runtime environments in a single Dockerfile.
Optimization
Practical techniques to shrink Docker image sizes, speed up builds, and harden images for production use.
Managing Images
Learn to tag, remove, save, load, and push Docker images, keeping your local environment clean and your registry organized.
Docker Containers
Running and managing Docker containers: the lifecycle, port publishing, environment variables, restart policies, and why a container exits immediately.
Running Containers
Master docker run - the most important Docker command. Learn every essential flag for port mapping, naming, detached mode, and more.
Lifecycle Management
Control every stage of a container's life including start, stop, restart, pause, kill, and understand the difference between each.
Exec & Interact
Shell into running containers, execute one-off commands, copy files, and debug live services with docker exec and docker cp.
Logs & Monitoring
Stream, filter, and manage container logs. Monitor resource usage with docker stats. Know what your containers are doing in real time.
Networking Basics
Understand Docker's networking model including bridge networks, port publishing, container DNS, and how containers communicate with each other.
Volumes & Storage
Persist data beyond container lifecycles with named volumes and bind mounts. Understand when to use each and how to manage them.
Env Vars & Config
Pass configuration into containers safely using environment variables, env files, and Docker secrets - without baking secrets into your images.
Cleanup & Pruning
Keep your Docker environment clean. Remove stopped containers, reclaim disk space, and build automated cleanup habits.
Dockerfile Basics
How to write a Dockerfile. Every instruction explained, layer caching and instruction order, .dockerignore, multi-stage builds, and the mistakes that bloat images.
Dockerfile FROM and Choosing a Base Image
FROM decides your image size and patch surface. Alpine vs slim vs distroless vs scratch, why Alpine hurts Python, and pinning by digest.
Dockerfile COPY vs ADD
When to use COPY and when ADD is right, --chown, --chmod, --from, checksums, .dockerignore, and the build-context errors that stop a build dead.
Dockerfile RUN
RUN executes at build time and commits a layer. Shell vs exec form, why cleanup must share the layer, BuildKit cache mounts and pipefail.
Dockerfile CMD vs ENTRYPOINT
CMD vs ENTRYPOINT. Exec vs shell form, how runtime arguments override each, using them together, and why signals get ignored.
Dockerfile ENV vs ARG
ARG exists only during the build; ENV persists into every container. Scoping across stages, why ARG leaks secrets, and the effect on cache.
Dockerfile WORKDIR, EXPOSE, USER and HEALTHCHECK
The instructions that finish a production Dockerfile. Why EXPOSE publishes nothing, why VOLUME is usually a mistake, and why Kubernetes ignores HEALTHCHECK.
Dockerfile Best Practices
A prioritised checklist for production Dockerfiles: the PID 1 signal problem, secrets that survive deletion, read-only filesystems, and hadolint in CI.
Real-World Dockerfile Examples
Complete production Dockerfiles for Node.js, Python, Go, React and Spring Boot. Every decision annotated, with the mistake each one avoids.
Docker Volumes
How Docker persists data. Named volumes vs bind mounts vs tmpfs, why container data disappears, permissions problems, backups, and reclaiming disk space.
Named Volumes
Create, use, inspect and share Docker named volumes. Persistent storage that survives container restarts and deletion.
Bind Mounts
Mount host directories into containers for local development and live code reloading. Bind mounts explained, and how they differ from named volumes.
Volume Management
List, inspect, back up, restore and clean up Docker volumes. The docker volume commands for day-to-day operations and data migrations.