Tutorial

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

1

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.

2

Why Use Docker?

The real benefits of Docker, consistency, isolation, portability and efficiency, with use cases across development, microservices and CI/CD.

3

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.

4

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.

5

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.

6

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.

7

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.

8

Key Docker Concepts

The Docker object model in one page. Image, container, layer, Dockerfile, registry, volume, network and Compose, and how they fit together.

9

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.

10

Image Naming & Tags

Learn how Docker images are named, versioned, and organized using registries, repositories, and tags.

11

Docker Hub

Explore Docker Hub - the world's largest container image registry. Learn to search, pull, and understand official images.

12

Docker Pull & Search

Learn how to pull Docker images from Docker Hub and search for the right ones using the CLI.

13

List & Inspect Images

Learn how to view, filter, and inspect Docker images on your local system to understand their contents and metadata.

14

Building Images

Learn to write Dockerfiles and use docker build to create custom images tailored to your applications.

15

Layers & Caching

Understand how Docker's layer system works and how to use build caching to make your builds dramatically faster.

16

Multi-Stage Builds

Use multi-stage builds to create lean, secure production images by separating build-time and runtime environments in a single Dockerfile.

17

Optimization

Practical techniques to shrink Docker image sizes, speed up builds, and harden images for production use.

18

Managing Images

Learn to tag, remove, save, load, and push Docker images, keeping your local environment clean and your registry organized.

19

Docker Containers

Running and managing Docker containers: the lifecycle, port publishing, environment variables, restart policies, and why a container exits immediately.

20

Running Containers

Master docker run - the most important Docker command. Learn every essential flag for port mapping, naming, detached mode, and more.

21

Lifecycle Management

Control every stage of a container's life including start, stop, restart, pause, kill, and understand the difference between each.

22

Exec & Interact

Shell into running containers, execute one-off commands, copy files, and debug live services with docker exec and docker cp.

23

Logs & Monitoring

Stream, filter, and manage container logs. Monitor resource usage with docker stats. Know what your containers are doing in real time.

24

Networking Basics

Understand Docker's networking model including bridge networks, port publishing, container DNS, and how containers communicate with each other.

25

Volumes & Storage

Persist data beyond container lifecycles with named volumes and bind mounts. Understand when to use each and how to manage them.

26

Env Vars & Config

Pass configuration into containers safely using environment variables, env files, and Docker secrets - without baking secrets into your images.

27

Cleanup & Pruning

Keep your Docker environment clean. Remove stopped containers, reclaim disk space, and build automated cleanup habits.

28

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.

29

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.

30

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.

31

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.

32

Dockerfile CMD vs ENTRYPOINT

CMD vs ENTRYPOINT. Exec vs shell form, how runtime arguments override each, using them together, and why signals get ignored.

33

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.

34

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.

35

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.

36

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.

37

Docker Volumes

How Docker persists data. Named volumes vs bind mounts vs tmpfs, why container data disappears, permissions problems, backups, and reclaiming disk space.

38

Named Volumes

Create, use, inspect and share Docker named volumes. Persistent storage that survives container restarts and deletion.

39

Bind Mounts

Mount host directories into containers for local development and live code reloading. Bind mounts explained, and how they differ from named volumes.

40

Volume Management

List, inspect, back up, restore and clean up Docker volumes. The docker volume commands for day-to-day operations and data migrations.