Skip to content

00. Docker Prerequisites

Before diving into Docker containerization, it is highly recommended to have a solid understanding of fundamental system administration and networking concepts. Containers are heavily reliant on the underlying Linux kernel and network stack.

Here is a practical breakdown of the prerequisites you should be comfortable with before starting Docker.

Since Docker natively utilizes Linux kernel features (like namespaces and cgroups) to isolate containers, understanding how Linux operates is crucial.

A container is fundamentally just a regular Linux process that is isolated from the rest of the system.

  • Concepts: Process IDs (PIDs), background vs foreground processes, signals (SIGKILL, SIGTERM).
  • Commands: ps, top, htop, kill.

Docker uses layered filesystems to build images.

  • Concepts: The Linux directory structure (/etc, /var, /home), mounting drives, symlinks.
  • Commands: ls, cd, pwd, df -h, mount.

Containers often run as the root user by default, which can be a security risk. Understanding Linux permissions is key to securing containers.

  • Concepts: UID (User ID), GID (Group ID), the /etc/passwd file, root vs standard users.
  • Commands: id, whoami, useradd, usermod.

When mapping volumes from your host machine into a Docker container, file permissions dictate whether the container can read or write to those files.

  • Concepts: Read (r), Write (w), Execute (x), owner/group/others, octal notation (e.g., 755, 644).
  • Commands: chmod, chown.

Environment variables are the primary way we pass configuration (like database passwords or API keys) into a Docker container at runtime.

  • Concepts: $PATH, system-wide vs user-specific variables.
  • Commands: export, echo $VAR_NAME, printenv.

Containers need to communicate with each other and the outside world. Networking fundamentals are required to expose container ports and link services.

A port is a logical endpoint for communication. When a web server container runs, it binds to a specific port.

  • Concepts: Well-known ports (80 for HTTP, 443 for HTTPS, 22 for SSH, 5432 for PostgreSQL).
  • Docker Context: You will frequently “map” a port on your host machine to a port inside the container (e.g., -p 8080:80).

The foundational protocols of the internet.

  • Concepts: IP Addresses (IPv4, IPv6), localhost (127.0.0.1), subnets. Docker creates its own virtual bridge network and assigns internal IP addresses to containers.

Domain Name System translates human-readable domain names to IP addresses.

  • Concepts: DNS resolution, /etc/hosts.
  • Docker Context: Docker provides internal DNS resolution so containers can communicate using their container names instead of IP addresses.

The protocols used for web traffic.

  • Concepts: HTTP Methods (GET, POST), Status Codes (200, 404, 500), SSL/TLS certificates.
  • Docker Context: You will often deploy reverse proxies (like Nginx) in Docker to route HTTP traffic and terminate HTTPS.

Most Docker deployments happen on remote Linux servers. You must know how to securely connect to these servers.

  • Concepts: SSH keys (public/private keypairs), passwordless authentication, the ~/.ssh/authorized_keys file.
  • Commands: ssh user@ip, ssh-keygen.

Infrastructure as Code (IaC) and containerization go hand-in-hand. Your Dockerfiles and configurations will always be stored in version control.

  • Concepts: Repositories, commits, branches, pushing/pulling.
  • Commands: git clone, git commit, git push, git pull.