Docker Engine Installation - Ubuntu 22.04

📚Table of Contents

Introduction

This blog post will guide you through a straightforward Docker Engine installation on Ubuntu 22.04 without Docker Desktop. If you’re installing Docker Desktop, you’re doing it wrong.

Install Docker on Ubuntu 22.04

Step 1: Update the System

sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

Step 2: Add Docker’s GPG Key

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

Step 3: Add the Docker 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

sudo apt update

Step 4: Verify Docker Installer is from Docker Repo

apt-cache policy docker-ce

You should see an output similar to the following:

docker-ce:
  Installed: (none)
  Candidate: 5:20.10.14~3-0~ubuntu-jammy
  Version table:
     5:20.10.14~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
     5:20.10.13~3-0~ubuntu-jammy 500
        500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages

Step 5: Install Docker Engine

sudo apt install docker-ce

Step 6: Verify Docker is Running

sudo systemctl status docker

Step 7: Run Docker Without sudo (Optional)

sudo usermod -aG docker ${USER}

# Validate user is in group by opening a new terminal window, or run the following:
su - ${USER} 

Conclusion

That’s it. With Docker installed, you’re ready to spin up containers and start working with containerized applications.