Docker

Intermediate · Roadmap · 59 lessons · 10 groups

Learn Docker in depth: how the engine and its runtimes fit together, running and inspecting containers, images and registries, writing Dockerfiles, BuildKit and multi-platform builds, storage, networking, Compose, container security, and running containers in production and CI.

0%

Not started

Nothing saved yet. Progress is kept in this browser until you sign in.

Start the path

What Docker is · 5

Running containers · 7

Images and registries · 7

Writing Dockerfiles · 7

BuildKit and advanced builds · 5

Storage and data · 5

Networking · 5

Docker Compose · 6

Container security · 7

Production and operations · 5

01Containers vs virtual machinesA VM virtualizes hardware and boots its own kernel. A container is a process on the host's kernel. What that costs, what it buys, and when you want both.Beginner · 9 min02The Docker architecture: client, daemon and runtimesWhat runs when you type docker run: the CLI, the Engine API, dockerd, containerd, the shim and runc, and why the work is split across five programs.Beginner · 14 min03The OCI standards: image, runtime and distributionThree Open Container Initiative specs define what an image is, how a runtime starts one and how registries serve it, which is why tools interoperate.Intermediate · 11 min04Installing Docker Engine and Docker DesktopDocker Engine on a Linux server from Docker's apt repository, Docker Desktop on a laptop, what each one actually installs, and the post-install traps.Beginner · 7 min05Docker alternatives: Podman, nerdctl and friendsPodman, nerdctl, Colima, Rancher Desktop, OrbStack and Apple's container run the same OCI images. How each differs from Docker and when to pick one.Intermediate · 6 min01docker run and the container lifecycleWhat docker run really does, the states a container moves through, how stop, kill and rm differ, and what an exit code like 137 is telling you.Beginner · 8 min02Interactive, detached and execWhat -i, -t and -d actually change, how attach differs from exec, how to leave a container without stopping it, and getting a shell into a running one.Beginner · 10 min03Configuring containers with environment variablesPassing settings with -e and --env-file, which value wins, the env-file format's surprises, and why environment variables are a poor place for secrets.Beginner · 15 min04Container logs and logging driversDocker captures what PID 1 writes to stdout and stderr. Reading it with docker logs, picking a logging driver, and stopping json-file from filling the disk.Intermediate · 17 min05Inspecting containers: inspect, top, stats and eventsRead a container's config and state with docker inspect and Go templates, its processes with top, its live usage with stats and its history with events.Intermediate · 1 min06Restart policies and health checksHow Docker restarts containers that exit, the back-off it uses, what a HEALTHCHECK reports, and why an unhealthy container is not restarted on its own.Intermediate · 17 min07Cleaning up: prune and disk usageWhere Docker's disk space goes, how to measure it with docker system df, what each prune command removes and keeps, and the things df doesn't show.Beginner · 12 min01Image names: repositories, tags and digestsHow Docker reads a name like nginx:1.31 or ghcr.io/acme/api@sha256:…, which registry it really means, and when to pin a tag, a digest or both.Beginner · 9 min02Layers, overlayfs and copy-on-writeHow read-only image layers and a thin writable layer become one filesystem with overlayfs, what copy-up and whiteouts cost, and where it all lives on disk.Intermediate · 13 min03Manifests, indexes and multi-platform imagesHow one tag serves amd64, arm64 and more: the image index, per-platform manifests, how a client picks one, and the attestation entries that ride along.Intermediate · 24 min04Choosing a base imageFull, slim, Alpine, distroless, hardened or scratch: what each base image puts under your app and what it costs in size, compatibility and debugging.Intermediate · 1 min05Docker Hub and other registriesWhat Docker Hub offers and limits, how to read its rate-limit headers, and the alternatives: GHCR, cloud registries, official-image mirrors, self-hosting.Beginner · 9 min06Tagging and pushing imagesdocker tag, login and push: what each does to your image, what goes over the wire, where credentials end up, and a tagging scheme that survives production.Beginner · 1 min07Running a private registrySelf-hosting images with the registry:3 image or Harbor: TLS, htpasswd auth, deleting and garbage-collecting, pull-through caching, and when not to bother.Advanced · 20 min01Dockerfile instructions, from FROM to CMDWhat each of the 18 Dockerfile instructions does, which ones change files and which only edit the image config, and the shell and exec forms.Beginner · 26 min02CMD, ENTRYPOINT and PID 1How CMD and ENTRYPOINT combine, why shell form makes docker stop hang for 10 seconds, and how exec, --init and STOPSIGNAL fix it.Intermediate · 12 min03The build context and .dockerignoreWhat the build context is, why COPY . . can ship your .git and .env into an image, and how .dockerignore patterns, negation and ** really match.Beginner · 14 min04Layer caching and instruction orderHow BuildKit decides a step is cached: command text for RUN, file checksums for COPY, build args from first use. And why stale cache bites.Intermediate · 10 min05Multi-stage buildsBuild with a full toolchain, ship only the result: named stages, COPY --from, --target for test and debug images, and how BuildKit skips unused stages.Intermediate · 6 min06Build arguments and environment variablesARG is for the build and ENV is for the container. Scope rules, how ENV overrides ARG, and why an ARG secret ends up in docker history anyway.Intermediate · 15 min07Linting Dockerfiles and build checksCatch Dockerfile mistakes before they ship: BuildKit's built-in build checks with docker build --check, the check directive, and hadolint in CI.Intermediate · 11 min01BuildKit and docker buildxBuildKit is the engine behind docker build and buildx is its client. Frontends, LLB, builders and drivers, exporters, and when to create your own builder.Intermediate · 10 min02Cache mounts and build secretsRUN --mount keeps package caches between builds without baking them into layers, and passes tokens and SSH keys to one step without leaking them.Intermediate · 1 min03Multi-platform buildsBuild one image tag for amd64 and arm64: --platform, the three strategies (QEMU, native nodes, cross-compiling), and the BUILDPLATFORM pattern.Advanced · 1 min04Build caches in CICI runners start with an empty build cache. Export it with --cache-to and import it with --cache-from: registry, gha, inline and local backends, min vs max.Advanced · 19 min05Shrinking imagesMeasure first, then cut: smaller bases, multi-stage builds, no package caches, no duplicate layers from chmod and chown, and static binaries on scratch.Intermediate · 17 min01The container filesystem is ephemeralFiles a container writes live in its writable layer: kept across restarts, deleted with docker rm and lost on every image upgrade. Where data goes instead.Beginner · 5 min02Named volumesCreate, mount, inspect and remove named volumes; how an empty volume is pre-filled from the image; and why Postgres 18 moved its volume path.Beginner · 6 min03Bind mounts and tmpfs mountsMap a host directory into a container for live code and config, or give it memory-only scratch space. Syntax differences, read-only mounts, and the traps.Intermediate · 10 min04File ownership and permissions in mountsWhy containers hit Permission denied on mounted files: the kernel compares numeric UIDs, not names. Matching UIDs, --user, chown-then-drop entrypoints.Intermediate · 17 min05Backing up and migrating volume dataBack up a volume with a throwaway tar container, restore it, stream it to another host over SSH, and know when a database dump beats copying files.Intermediate · 9 min01The default bridge networkHow a container on docker0 gets an address, reaches the internet through NAT, and why the default bridge has no DNS and is not for production.Intermediate · 9 min02User-defined networks and container DNSCreate your own bridge networks so containers find each other by name through Docker's DNS at 127.0.0.11, stay isolated from other stacks, and rewire live.Intermediate · 1 min03Publishing ports and the host firewallWhat -p really does, why a published port ignores ufw, and how to keep databases private: bind to 127.0.0.1, filter in DOCKER-USER, publish one proxy.Intermediate · 12 min04Host, none, macvlan and ipvlan networksThe network drivers that skip Docker's bridge: share the host's stack, have no network at all, or put containers straight on the LAN with their own addresses.Advanced · 4 min05Reaching the host and the outside worldWhy localhost in a container is the container, how host.docker.internal and host-gateway reach host services, and the proxy, DNS and MTU traps on the way out.Intermediate · 8 min01Why Compose existsFive docker run commands, typed in the right order with the right flags, every time. Compose turns that into one declared, versioned project.Intermediate · 10 min02The Compose file: services, networks and volumesHow compose.yaml is laid out: services, networks and volumes, short and long syntax, isolated networks, external resources, and reuse with x- blocks.Intermediate · 20 min03Startup order: depends_on and health checksdepends_on orders container creation, not readiness. Health checks, service_healthy, one-shot migrations and why your app must still retry.Intermediate · 4 min04Variables, env files and profilesOne Compose file, many machines: ${VAR} interpolation, the .env file versus env_file, which value wins, and profiles for optional services.Intermediate · 5 min05Compose for development: watch, overrides and includeA fast inner loop with Compose: override files and merge rules, !reset and !override, include for shared stacks, and compose watch to sync code.Intermediate · 18 min06Compose in production and its limitsRunning Compose on one server for real: a production overlay, pinned images, restarts, log rotation and deploys, and the signs you have outgrown it.Intermediate · 19 min01Container isolation and its limitsWhat Docker actually puts around a container by default, why one shared kernel is the real boundary, and when you need gVisor or a microVM instead.Advanced · 13 min02The Docker socket is rootWhy access to /var/run/docker.sock, or the docker group, equals root on the host, why read-only mounts don't help, and safer ways to give tools access.Advanced · 5 min03Running as non-root and rootless DockerThree ways to take root away: a non-root USER in the image, user-namespace remapping, and rootless Docker, where even the daemon is an ordinary user.Advanced · 4 min04Capabilities, seccomp and read-only containersShrink what a container can do: drop capabilities, block privilege gain, keep or tighten the seccomp profile, and make the root filesystem read-only.Advanced · 7 min05Secrets at build time and run timeHow secrets leak into images through ARG, ENV and deleted files, why environment variables are a weak place for them, and how Compose mounts secrets as files.Intermediate · 4 min06Scanning images for vulnerabilitiesHow image scanners turn a package list into CVE reports, why most findings have no fix, and how to gate CI on the ones that matter with Scout, Trivy or Grype.Intermediate · 6 min07Signing and verifying imagesSignatures prove who built an image digest. How Sigstore keyless signing works, what a real cosign signature contains, and how to verify before you deploy.Advanced · 9 min01Resource limits for memory, CPU and PIDsContainers have no limits by default. How --memory, --cpus, --cpu-shares and --pids-limit map to cgroups, what an OOM kill looks like, and CPU throttling.Intermediate · 5 min02Debugging a running containerA method for broken containers: read state, exit codes and logs first, then get inside with exec, docker debug, a namespace-sharing sidecar or nsenter.Intermediate · 29 min03Monitoring containersWhat to watch on a Docker host and where the numbers come from: docker stats, the Engine API, events, cAdvisor, Prometheus and Grafana, and alerts.Intermediate · 11 min04Docker in CI pipelinesHow a CI job gets a Docker engine (socket, Docker-in-Docker, hosted VMs, remote builders), and a pipeline that tests, tags, pushes and signs images.Advanced · 1 min05Docker contexts and remote enginesDrive Docker engines on other machines from your own CLI: contexts over SSH or TLS, how the CLI picks an endpoint, and what changes when the engine is remote.Intermediate · 11 min

What Docker is

5 lessons

  1. 01 / 05Containers vs virtual machinesA VM virtualizes hardware and boots its own kernel. A container is a process on the host's kernel. What that costs, what it buys, and when you want both.9 min
  2. 02 / 05The Docker architecture: client, daemon and runtimesWhat runs when you type docker run: the CLI, the Engine API, dockerd, containerd, the shim and runc, and why the work is split across five programs.14 min
  3. 03 / 05The OCI standards: image, runtime and distributionThree Open Container Initiative specs define what an image is, how a runtime starts one and how registries serve it, which is why tools interoperate.11 min
  4. 04 / 05Installing Docker Engine and Docker DesktopDocker Engine on a Linux server from Docker's apt repository, Docker Desktop on a laptop, what each one actually installs, and the post-install traps.7 min
  5. 05 / 05Docker alternatives: Podman, nerdctl and friendsPodman, nerdctl, Colima, Rancher Desktop, OrbStack and Apple's container run the same OCI images. How each differs from Docker and when to pick one.6 min

Running containers

7 lessons

  1. 01 / 07docker run and the container lifecycleWhat docker run really does, the states a container moves through, how stop, kill and rm differ, and what an exit code like 137 is telling you.8 min
  2. 02 / 07Interactive, detached and execWhat -i, -t and -d actually change, how attach differs from exec, how to leave a container without stopping it, and getting a shell into a running one.10 min
  3. 03 / 07Configuring containers with environment variablesPassing settings with -e and --env-file, which value wins, the env-file format's surprises, and why environment variables are a poor place for secrets.15 min
  4. 04 / 07Container logs and logging driversDocker captures what PID 1 writes to stdout and stderr. Reading it with docker logs, picking a logging driver, and stopping json-file from filling the disk.17 min
  5. 05 / 07Inspecting containers: inspect, top, stats and eventsRead a container's config and state with docker inspect and Go templates, its processes with top, its live usage with stats and its history with events.1 min
  6. 06 / 07Restart policies and health checksHow Docker restarts containers that exit, the back-off it uses, what a HEALTHCHECK reports, and why an unhealthy container is not restarted on its own.17 min
  7. 07 / 07Cleaning up: prune and disk usageWhere Docker's disk space goes, how to measure it with docker system df, what each prune command removes and keeps, and the things df doesn't show.12 min

Images and registries

7 lessons

  1. 01 / 07Image names: repositories, tags and digestsHow Docker reads a name like nginx:1.31 or ghcr.io/acme/api@sha256:…, which registry it really means, and when to pin a tag, a digest or both.9 min
  2. 02 / 07Layers, overlayfs and copy-on-writeHow read-only image layers and a thin writable layer become one filesystem with overlayfs, what copy-up and whiteouts cost, and where it all lives on disk.13 min
  3. 03 / 07Manifests, indexes and multi-platform imagesHow one tag serves amd64, arm64 and more: the image index, per-platform manifests, how a client picks one, and the attestation entries that ride along.24 min
  4. 04 / 07Choosing a base imageFull, slim, Alpine, distroless, hardened or scratch: what each base image puts under your app and what it costs in size, compatibility and debugging.1 min
  5. 05 / 07Docker Hub and other registriesWhat Docker Hub offers and limits, how to read its rate-limit headers, and the alternatives: GHCR, cloud registries, official-image mirrors, self-hosting.9 min
  6. 06 / 07Tagging and pushing imagesdocker tag, login and push: what each does to your image, what goes over the wire, where credentials end up, and a tagging scheme that survives production.1 min
  7. 07 / 07Running a private registrySelf-hosting images with the registry:3 image or Harbor: TLS, htpasswd auth, deleting and garbage-collecting, pull-through caching, and when not to bother.20 min

Writing Dockerfiles

7 lessons

  1. 01 / 07Dockerfile instructions, from FROM to CMDWhat each of the 18 Dockerfile instructions does, which ones change files and which only edit the image config, and the shell and exec forms.26 min
  2. 02 / 07CMD, ENTRYPOINT and PID 1How CMD and ENTRYPOINT combine, why shell form makes docker stop hang for 10 seconds, and how exec, --init and STOPSIGNAL fix it.12 min
  3. 03 / 07The build context and .dockerignoreWhat the build context is, why COPY . . can ship your .git and .env into an image, and how .dockerignore patterns, negation and ** really match.14 min
  4. 04 / 07Layer caching and instruction orderHow BuildKit decides a step is cached: command text for RUN, file checksums for COPY, build args from first use. And why stale cache bites.10 min
  5. 05 / 07Multi-stage buildsBuild with a full toolchain, ship only the result: named stages, COPY --from, --target for test and debug images, and how BuildKit skips unused stages.6 min
  6. 06 / 07Build arguments and environment variablesARG is for the build and ENV is for the container. Scope rules, how ENV overrides ARG, and why an ARG secret ends up in docker history anyway.15 min
  7. 07 / 07Linting Dockerfiles and build checksCatch Dockerfile mistakes before they ship: BuildKit's built-in build checks with docker build --check, the check directive, and hadolint in CI.11 min

BuildKit and advanced builds

5 lessons

  1. 01 / 05BuildKit and docker buildxBuildKit is the engine behind docker build and buildx is its client. Frontends, LLB, builders and drivers, exporters, and when to create your own builder.10 min
  2. 02 / 05Cache mounts and build secretsRUN --mount keeps package caches between builds without baking them into layers, and passes tokens and SSH keys to one step without leaking them.1 min
  3. 03 / 05Multi-platform buildsBuild one image tag for amd64 and arm64: --platform, the three strategies (QEMU, native nodes, cross-compiling), and the BUILDPLATFORM pattern.1 min
  4. 04 / 05Build caches in CICI runners start with an empty build cache. Export it with --cache-to and import it with --cache-from: registry, gha, inline and local backends, min vs max.19 min
  5. 05 / 05Shrinking imagesMeasure first, then cut: smaller bases, multi-stage builds, no package caches, no duplicate layers from chmod and chown, and static binaries on scratch.17 min

Storage and data

5 lessons

  1. 01 / 05The container filesystem is ephemeralFiles a container writes live in its writable layer: kept across restarts, deleted with docker rm and lost on every image upgrade. Where data goes instead.5 min
  2. 02 / 05Named volumesCreate, mount, inspect and remove named volumes; how an empty volume is pre-filled from the image; and why Postgres 18 moved its volume path.6 min
  3. 03 / 05Bind mounts and tmpfs mountsMap a host directory into a container for live code and config, or give it memory-only scratch space. Syntax differences, read-only mounts, and the traps.10 min
  4. 04 / 05File ownership and permissions in mountsWhy containers hit Permission denied on mounted files: the kernel compares numeric UIDs, not names. Matching UIDs, --user, chown-then-drop entrypoints.17 min
  5. 05 / 05Backing up and migrating volume dataBack up a volume with a throwaway tar container, restore it, stream it to another host over SSH, and know when a database dump beats copying files.9 min

Networking

5 lessons

  1. 01 / 05The default bridge networkHow a container on docker0 gets an address, reaches the internet through NAT, and why the default bridge has no DNS and is not for production.9 min
  2. 02 / 05User-defined networks and container DNSCreate your own bridge networks so containers find each other by name through Docker's DNS at 127.0.0.11, stay isolated from other stacks, and rewire live.1 min
  3. 03 / 05Publishing ports and the host firewallWhat -p really does, why a published port ignores ufw, and how to keep databases private: bind to 127.0.0.1, filter in DOCKER-USER, publish one proxy.12 min
  4. 04 / 05Host, none, macvlan and ipvlan networksThe network drivers that skip Docker's bridge: share the host's stack, have no network at all, or put containers straight on the LAN with their own addresses.4 min
  5. 05 / 05Reaching the host and the outside worldWhy localhost in a container is the container, how host.docker.internal and host-gateway reach host services, and the proxy, DNS and MTU traps on the way out.8 min

Docker Compose

6 lessons

  1. 01 / 06Why Compose existsFive docker run commands, typed in the right order with the right flags, every time. Compose turns that into one declared, versioned project.10 min
  2. 02 / 06The Compose file: services, networks and volumesHow compose.yaml is laid out: services, networks and volumes, short and long syntax, isolated networks, external resources, and reuse with x- blocks.20 min
  3. 03 / 06Startup order: depends_on and health checksdepends_on orders container creation, not readiness. Health checks, service_healthy, one-shot migrations and why your app must still retry.4 min
  4. 04 / 06Variables, env files and profilesOne Compose file, many machines: ${VAR} interpolation, the .env file versus env_file, which value wins, and profiles for optional services.5 min
  5. 05 / 06Compose for development: watch, overrides and includeA fast inner loop with Compose: override files and merge rules, !reset and !override, include for shared stacks, and compose watch to sync code.18 min
  6. 06 / 06Compose in production and its limitsRunning Compose on one server for real: a production overlay, pinned images, restarts, log rotation and deploys, and the signs you have outgrown it.19 min

Container security

7 lessons

  1. 01 / 07Container isolation and its limitsWhat Docker actually puts around a container by default, why one shared kernel is the real boundary, and when you need gVisor or a microVM instead.13 min
  2. 02 / 07The Docker socket is rootWhy access to /var/run/docker.sock, or the docker group, equals root on the host, why read-only mounts don't help, and safer ways to give tools access.5 min
  3. 03 / 07Running as non-root and rootless DockerThree ways to take root away: a non-root USER in the image, user-namespace remapping, and rootless Docker, where even the daemon is an ordinary user.4 min
  4. 04 / 07Capabilities, seccomp and read-only containersShrink what a container can do: drop capabilities, block privilege gain, keep or tighten the seccomp profile, and make the root filesystem read-only.7 min
  5. 05 / 07Secrets at build time and run timeHow secrets leak into images through ARG, ENV and deleted files, why environment variables are a weak place for them, and how Compose mounts secrets as files.4 min
  6. 06 / 07Scanning images for vulnerabilitiesHow image scanners turn a package list into CVE reports, why most findings have no fix, and how to gate CI on the ones that matter with Scout, Trivy or Grype.6 min
  7. 07 / 07Signing and verifying imagesSignatures prove who built an image digest. How Sigstore keyless signing works, what a real cosign signature contains, and how to verify before you deploy.9 min

Production and operations

5 lessons

  1. 01 / 05Resource limits for memory, CPU and PIDsContainers have no limits by default. How --memory, --cpus, --cpu-shares and --pids-limit map to cgroups, what an OOM kill looks like, and CPU throttling.5 min
  2. 02 / 05Debugging a running containerA method for broken containers: read state, exit codes and logs first, then get inside with exec, docker debug, a namespace-sharing sidecar or nsenter.29 min
  3. 03 / 05Monitoring containersWhat to watch on a Docker host and where the numbers come from: docker stats, the Engine API, events, cAdvisor, Prometheus and Grafana, and alerts.11 min
  4. 04 / 05Docker in CI pipelinesHow a CI job gets a Docker engine (socket, Docker-in-Docker, hosted VMs, remote builders), and a pipeline that tests, tags, pushes and signs images.1 min
  5. 05 / 05Docker contexts and remote enginesDrive Docker engines on other machines from your own CLI: contexts over SSH or TLS, how the CLI picks an endpoint, and what changes when the engine is remote.11 min
Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark