This runbook explains how to install Docker on a Linux server.

Prerequisites

  • Access to the server
  • Root or sudo privileges

Steps

  1. Update Package List
sudo apt update
  1. Install Required Packages
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
  1. Add Docker GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  1. Add Docker Repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  1. Install Docker
sudo apt update
sudo apt install -y docker-ce
  1. Start and Enable Docker
sudo systemctl start docker
sudo systemctl enable docker

Verification

  • Check Docker version:
docker --version
  • Run a test container:
sudo docker run hello-world