Skip to main content

Installing Docker

Setting Up Your Magical Lunchbox

Before you can explore the world of containers, you need the right toolkit. Installing Docker is like setting up your workshop: once the tools are in place, you can start building, experimenting, and deploying applications. In this chapter, we’ll walk through how to install Docker on different operating systems, understand the installation components, and verify that everything works correctly.


Installation Foundations

1. What Gets Installed?

When you install Docker, you’re setting up:

  • Docker Engine: The runtime that builds and runs containers.
  • Docker CLI: The command‑line interface to interact with Docker.
  • Docker Daemon: The background service that manages containers, images, volumes, and networks.
  • Optional Tools: Docker Compose (for multi‑container apps) and Docker Desktop (GUI for Windows/macOS).

2. Installation Options

  • Docker Desktop:
    • Available for Windows and macOS.
    • Provides a GUI, integrated Kubernetes, and developer‑friendly features.
  • Docker Engine (Community Edition):
    • Installed directly on Linux distributions.
    • Lightweight and suitable for servers and production environments.

Step‑by‑Step Installation

A. Installing on Linux (Ubuntu Example)

Install Docker Engine:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Set up the repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Install prerequisites:

sudo apt-get install ca-certificates curl gnupg lsb-release

Update your package index:

sudo apt-get update

B. Installing on Windows

  • Download Docker Desktop for Windows from Docker’s official site.
  • Run the installer and follow the wizard.
  • Ensure WSL 2 (Windows Subsystem for Linux) is enabled for best performance.

C. Installing on macOS

  • Download Docker Desktop for Mac.
  • Drag the Docker icon into Applications.
  • Launch Docker Desktop and verify installation.

✅ Verification Steps

After installation, verify Docker is working:

docker --version
docker run hello-world
  • The first command shows the installed version.
  • The second command runs a test container that prints a confirmation message.

Things to Remember

  • Docker Desktop is ideal for developers on Windows/macOS.
  • Docker Engine is the preferred choice for Linux servers.
  • Always verify installation with docker run hello-world.

Practice Exercise

  • Install Docker on your system following the steps above.
  • Run docker info to explore details about your Docker environment.
  • Note down the storage driver, number of containers, and version of Docker Engine.

The Hackers Notebook

Installing Docker sets up the engine, CLI, and daemon that power containerization. Whether you’re on Linux, Windows, or macOS, the process ensures you’re ready to build, ship, and run containers. With Docker installed, learners can now move confidently into hands‑on labs and deeper exploration.


Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 26, 2025