Skip to main content
RunBook Academy

← All labs in Docker & Containers

Lab · foundation · ~30 min

Lab 5: Install Docker and verify the engine

B · Nested virtualisationC · Simulation

Objectives

  • Install Docker Engine from Docker's official repository
  • Pin the major version
  • Verify the daemon, socket, and engine version

Prerequisites

  • A Linux host with sudo
  • curl, gpg, apt installed

Objective

Install Docker Engine from the official apt repository on a fresh Ubuntu 24.04 LTS host. Verify the install end-to-end. Pin the major version so subsequent apt upgrade calls do not surprise you.

Requirements

  • Ubuntu 24.04 LTS (or 22.04 LTS) host, freshly installed.
  • sudo access.
  • Outbound HTTPS to download.docker.com.
  • A non-root user you can add to the docker group, or sudo for every docker invocation.

Tasks

Task 1: Add Docker’s official GPG key

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

Task 2: Add the repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Task 3: Install pinned version

# List available versions
apt-cache madison docker-ce | head -5

# Install a specific version (example: 28.1.1)
sudo apt-get install -y \
  docker-ce=5:28.1.1-1~ubuntu.24.04~noble \
  docker-ce-cli=5:28.1.1-1~ubuntu.24.04~noble \
  containerd.io \
  docker-buildx-plugin \
  docker-compose-plugin

Task 4: Pin the major version

sudo apt-mark hold docker-ce docker-ce-cli

Task 5: Enable and start the daemon

sudo systemctl enable --now docker
sudo systemctl status docker

Task 6: Verify

docker version
docker info
sudo docker run --rm hello-world

Task 7: Non-root user

sudo usermod -aG docker $USER
# log out and back in
docker ps

Expected outcome

  • docker version shows Server Version 28.x.
  • docker info lists the storage driver, cgroup driver, and kernel version.
  • hello-world prints its standard success message.
  • The user can run docker ps without sudo.

Cleanup

Nothing to clean up. The hello-world container is --rm and exits immediately.

Verification status

Last reviewed
2026-08-09
Executed end to end
not yet run on hardware

The commands and configuration here have been reviewed against the verified software versions, but nobody has run this lab start to finish on a system meeting its prerequisites. Treat the Expected Outcome as the intended result rather than an observed one, and keep the Cleanup section to hand.