LearnDevOpsHands-On Labs
All Tutorials
🐳
Most Popular · Beginner

Docker & Containerization

Master container virtualization, Dockerfiles, multi-stage builds, Docker Compose, volumes, networking, and security best practices.

40 Modules & Lessons
Estimated Time: ~12 Hours

Curriculum & Notes

Click any title or "See Notes" to read concepts

1Module 1: Docker Fundamentals & Setup

8 lessons
Introduction to Docker

Learn what Docker is and why developers use it. Understand images vs containers, how Docker differs from a virtual machine, the basic workflow and its limits.

Why Use Docker?

Find out why teams use Docker: consistent environments, faster deployment, easier scaling and microservices support, with real-world use cases.

Docker vs Virtual Machines

Compare Docker containers and virtual machines on architecture, startup time, isolation and security, and learn when to choose one or use both together.

Installing Docker

Choose between Docker Desktop and Docker Engine, check the requirements, verify the install with docker run hello-world, and fix the three most common failures.

Installing Docker on Windows

Install Docker Desktop on Windows 10 or 11 with the WSL 2 backend. Covers prerequisites, settings, troubleshooting and filesystem choice for build speed.

Installing Docker on macOS

Install Docker Desktop on macOS for Intel or Apple Silicon (M1, M2, M3). Covers setup, resource settings, the Dashboard, verifying the install and common fixes.

Installing Docker on Linux

Install Docker Engine on Ubuntu, Debian, CentOS, RHEL or Fedora with working commands, then run docker without sudo, enable it on boot and fix common errors.

Key Docker Concepts

A plain-English guide to core Docker concepts: images, containers, Dockerfile, registry, volumes, networks, Compose, and how the client talks to the daemon.

2Module 2: Images, Registry & Optimization

10 lessons
Docker Images

Learn what a Docker image is, how layers and tags work, how to shrink images, and how to reclaim disk space by removing dangling images and old tags.

Image Naming & Tags

Understand how Docker image names and tags are structured, tag images with docker tag, avoid the latest trap, and pin exact versions using digests.

Docker Hub

Learn what Docker Hub is, how to find official images, and how to work around pull rate limits. A practical intro to using the default Docker registry.

Docker Pull & Search

Use docker pull to download images by tag or digest, read the pull output, and find images with docker search. Includes a hands-on Docker Hub exercise.

List & Inspect Images

Use docker images, docker inspect and docker history to list local images, read their metadata and layers, and check how much disk space Docker uses.

Building Images

Learn how to build a Docker image with a Dockerfile and docker build. Covers core instructions, .dockerignore and a complete Python API example.

Layers & Caching

See how Docker image layers and the build cache work, why Dockerfile order matters, and how to speed up docker build by avoiding unneeded cache misses.

Multi-Stage Builds

Shrink your Docker image with multi-stage builds. See how COPY --from works, follow real examples, and target a single stage with docker build --target.

Optimization

Reduce Docker image size with slim base images, merged RUN layers, a .dockerignore file and non-root users. Eight practical steps with examples.

Managing Images

Manage local images with docker tag, docker rmi, docker push and docker save/load. Includes cleanup with docker image prune and the export vs save difference.

3Module 3: Container Runtime & Networking

9 lessons
Docker Containers

Learn how Docker containers work, from docker run and the container lifecycle to port publishing, restart policies and why a container exits immediately.

Running Containers

Learn the docker run command with real examples: detached and interactive mode, naming, port mapping, resource limits, restart policies and more.

Lifecycle Management

Understand docker stop vs kill and every container state. Start, restart, pause and rename containers, and read exit codes to see why one stopped.

Exec & Interact

Use docker exec -it to open a bash shell in a container, then copy files with docker cp and inspect processes with docker top, attach and inspect.

Logs & Monitoring

Read container output with docker logs -f and --tail, filter it with grep, and monitor resource use with docker stats, events and health checks.

Networking Basics

Learn how Docker networking works: bridge, host and user-defined networks, port publishing with -p, container DNS, and how EXPOSE differs from -p.

Volumes & Storage

Keep data after a container is removed. Compare named volumes, bind mounts and tmpfs, then share, back up and restore volumes with working commands.

Env Vars & Config

Pass docker environment variables with the -e flag and --env-file, check them in a running container, and learn why secrets need a safer approach.

Cleanup & Pruning

Free disk space with docker system prune, docker rm and docker image prune. Learn what each command deletes, what is safe, and how to automate cleanup.

4Module 4: Dockerfile Deep Dive & Syntax

9 lessons
Dockerfile Basics

Learn how to write a Dockerfile: FROM, COPY, RUN and CMD, layer caching, .dockerignore, multi-stage builds, HEALTHCHECK and the mistakes that bloat images.

Dockerfile FROM and Choosing a Base Image

Choose the right Dockerfile FROM base image: alpine vs slim vs full, pinning tags and digests, multi-stage FROM, platform targeting and the scratch image.

Dockerfile COPY vs ADD

Learn when to use COPY vs ADD in a Dockerfile. Covers build context, --chown and --chmod, COPY --from, the dependency-manifest pattern and .dockerignore.

Dockerfile RUN

Learn how the Dockerfile RUN instruction works, including shell vs exec form, apt-get best practices, same-layer cleanup, cache mounts, secrets and heredocs.

Dockerfile CMD vs ENTRYPOINT

Learn the difference between CMD and ENTRYPOINT in a Dockerfile, how to combine them, when to use exec vs shell form, and how to override both at runtime.

Dockerfile ENV vs ARG

Learn the difference between ENV and ARG in a Dockerfile, how ARG scoping works, why neither is safe for secrets, and how ARG affects the build cache.

Dockerfile WORKDIR, EXPOSE, USER and HEALTHCHECK

Learn what WORKDIR, EXPOSE, USER, LABEL and HEALTHCHECK do in a Dockerfile, why EXPOSE publishes nothing, and when VOLUME causes problems in builds.

Dockerfile Best Practices

Write safer, smaller Dockerfiles. Covers exec form for SIGTERM, non-root users, secrets, layer order, multi-stage builds, pinned bases, scanning and hadolint.

Real-World Dockerfile Examples

Copy production-ready Dockerfile examples for Node.js, Python FastAPI, Go, React with Nginx, Spring Boot and Django, and see the pattern they all share.

5Module 5: Storage & Volumes

4 lessons
Docker Volumes

Learn why container data disappears and how Docker volumes fix it. Compare the three mount types, handle permission problems, and back up or clean up volumes.

Named Volumes

Create Docker named volumes with docker volume create, -v and --mount. See how data survives container removal and how to share a volume.

Bind Mounts

Learn how to use a Docker bind mount with -v and --mount to share a host directory, make it read-only with :ro, and set up live reload for development.

Volume Management

Manage Docker volumes with docker volume ls, inspect, rm and prune. Learn how to back up a volume, restore it from a tar archive and migrate data between hosts.