Docker learning path
Build your own image, preserve data, and run services together with Compose.
Six independent labs teach the core container workflow. Examples use Linux containers and do not cover all production security or registry operations.
Use Docker Engine or Docker Desktop with Linux containers, Compose v2, a POSIX shell, and curl on a personal practice host. Clean up only the study-prefixed resources you create. Pulling images requires network access.
Essential concepts before you start
Containers and virtual machines
Containers share a host kernel while isolating execution environments such as processes, filesystems, and networking. A virtual machine runs a separate guest kernel. Docker Desktop can run Linux containers inside a Linux VM, so the desktop OS and container kernel need not be the same.
Images, tags, and containers
An image supplies files and default execution settings; a container is an instance created from it. Multiple containers can share an image while keeping distinct writable layers. Tags are movable names, while digests identify content—an important distinction for reproducibility.
Dockerfiles and build context
A Dockerfile describes image construction. COPY reads files from the build context and RUN executes during the build. CMD usually provides the default runtime command. Starting a server in RUN does not replace configuring how it starts when the container runs.
Writable layers, volumes, and bind mounts
A writable layer belongs to a container and is removed with it. A named volume is separately managed storage; a bind mount exposes a specified host path. Choose based on lifetime and host coupling: sharing development files and preserving application data are different needs.
Ports and networks
Distinguish the application’s container port from the published host port. -p 8080:80 maps host 8080 to container 80. Containers on the same user-defined bridge can use the server name and internal port; their own localhost does not refer to another container.
Processes, logs, and exit state
Container lifetime follows its primary process. A one-shot task can finish successfully with exit zero. Use ps -a, logs, and inspect together; an always-running server and a batch task have different success criteria.
Images & Builds
Understand the container lifecycle and build your own image.
- Run and Inspect Your First Container · 15 min
- Build Your Own Web Image · 25 min
Data & Networking
Keep data beyond a container and connect services.
- Keep Data Beyond a Container · 20 min
- Connect Containers by Name · 20 min
Compose & Diagnostics
Run multiple services and investigate failures.
- Run Services with Compose · 25 min
- Diagnose Failures with Logs and Exit Codes · 20 min