✦ For everyone, free.

Practical knowledge for real and everyday life

Home

20 Docker Learning Path

A focused guide to Docker Learning Path, connecting core concepts with practical Docker and container operations.

Learning Docker effectively follows a progression from understanding its fundamental concepts to operating it in production-grade environments. The technology covers a wide range of topics — from running a single container to orchestrating multi-service applications, managing networking, handling persistence, securing deployments, and operating at scale. The learning path below describes the natural sequence of concepts and skills that build on each other.

Stage 1: Core Concepts and First Container

The starting point is understanding what Docker is at a conceptual level: a platform for running applications inside isolated containers. A container packages an application with all its dependencies into a single, portable unit that runs consistently regardless of the host environment.

Key concepts to establish first:

  • Images vs. containers: An image is a read-only template; a container is a running instance of an image.
  • The Docker daemon and CLI: The daemon runs on the host and manages containers; the CLI sends commands to the daemon.
  • Pulling images: Images are pulled from registries (Docker Hub by default).

First practical commands:

docker run hello-world
docker run -it ubuntu bash
docker ps
docker ps -a
docker images

These commands verify Docker is installed, demonstrate running a container interactively, and show how to list running and stopped containers and available images.

Stage 2: Container Lifecycle Management

After running a first container, the next focus is controlling the full lifecycle of containers:

docker run -d --name my_web nginx
docker stop my_web
docker start my_web
docker restart my_web
docker rm my_web

Understanding the difference between docker stop (graceful SIGTERM) and docker kill (SIGKILL), what stopped containers retain on disk, and how container names work are essential operational skills at this stage.

Stage 3: Building Images with Dockerfiles

Custom images are built using Dockerfiles. A Dockerfile is a sequential set of instructions that defines the image:

FROM ubuntu:22.04
RUN apt-get update && apt-get install -y python3
WORKDIR /app
COPY . .
CMD ["python3", "app.py"]
docker build -t my_app:1.0 .
docker run --rm my_app:1.0

Key Dockerfile instructions to learn: FROM, RUN, COPY, ADD, WORKDIR, ENV, EXPOSE, CMD, ENTRYPOINT, and multi-stage builds. Understanding layer caching and how instruction order affects build performance is critical for writing efficient Dockerfiles.

Stage 4: Ports, Volumes, and Environment Variables

Applications require external connectivity and persistent storage. This stage covers:

Exposing ports:

docker run -d -p 8080:80 nginx

Mounting volumes for persistent data:

docker run -d -v my_data:/var/lib/mysql mysql:8
docker run -d -v /host/path:/app/config nginx

Setting environment variables:

docker run -e DATABASE_URL=postgres://... my_app
docker run --env-file .env my_app

These concepts are necessary for any real-world application: databases need persistent volumes, web services need published ports, and application configuration is injected via environment variables.

Stage 5: Networking

Containers communicate with each other through Docker networks. By default, containers on the same custom bridge network can reach each other by container name:

docker network create my_network
docker run -d --name db --network my_network postgres:15
docker run -d --name app --network my_network my_app

Understanding the difference between the default bridge network (where containers use IP addresses) and user-defined bridge networks (where DNS by container name works) is a frequent source of confusion for beginners.

Stage 6: Docker Compose

Docker Compose defines multi-container applications in a single docker-compose.yml file. It is the standard tool for running applications with multiple interdependent services in development:

services:
  web:
    build: .
    ports:
      - "8080:80"
    environment:
      - DATABASE_URL=postgres://user:pass@db/mydb
    depends_on:
      - db
  db:
    image: postgres:15
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:
docker compose up -d
docker compose logs -f
docker compose down

Docker Compose is the primary tool for local development workflows and represents a significant leap in practical productivity.

Stage 7: Registry Operations

Publishing images to a registry makes them available to other machines and team members:

docker tag my_app:1.0 registry.example.com/my_app:1.0
docker push registry.example.com/my_app:1.0
docker pull registry.example.com/my_app:1.0

Understanding Docker Hub, private registries, image tagging conventions, and registry authentication is necessary for any CI/CD or deployment workflow.

Stage 8: Resource Constraints and Security

Containers running without limits can consume all available host resources. Resource constraints protect host stability:

docker run --memory 512m --cpus 0.5 my_app

Security concepts at this stage include running containers as non-root users, read-only root filesystems, dropping Linux capabilities, and avoiding privileged mode.

Stage 9: Debugging and Observability

Production operations require debugging skills:

docker logs my_container
docker logs --follow my_container
docker exec -it my_container bash
docker inspect my_container
docker stats
docker events

Understanding how to read logs, enter running containers for inspection, extract configuration via docker inspect, and monitor live resource usage with docker stats are core operational competencies.

Stage 10: System Maintenance

Disk space management and host hygiene:

docker system df
docker system prune
docker container prune
docker image prune --all
docker volume prune

Knowing how to identify and remove unused containers, images, volumes, and build cache prevents disk exhaustion on production and development hosts.

Stage 11: Advanced Topics

After the core path is established, advanced topics include:

  • Multi-platform builds: Building images for multiple CPU architectures simultaneously with docker buildx.
  • BuildKit features: Cache mounts, secret mounts, and multi-stage optimizations.
  • Docker Swarm: Native orchestration for multi-host deployments.
  • Container security scanning: Using tools to identify vulnerabilities in image layers.
  • Rootless Docker: Running the Docker daemon without root privileges.
  • Custom runtimes: Kata Containers, gVisor for stronger isolation.
  • Kubernetes: The natural progression beyond Docker Swarm for large-scale container orchestration.

Each stage builds on the skills from the previous one. Jumping to Kubernetes without a solid foundation in containers, networking, and Docker Compose typically leads to confusion about which problems the orchestration layer is solving versus which are inherent to containers themselves.

Content in this section