How to Install Docker on Ubuntu 22.04

Docker is a popular containerization that allows you to easily deploy applications as portable containers. This guide will show you how to install Docker on Ubuntu 22.04.

Each docker application is standalone, lightweight and highly portable, allowing you to deploy apps virtually anywhere. Furthermore, each container contains all the coded, dependencies or libraries, system tools, and settings to run each application.

How Install Docker on Ubuntu 22.04

Although the Ubuntu’s repositories by default do have docker packages ready to be installed, they might not be the latest version.

Updating system, required packages, GPG Key & APT sources

First, update our systems’ existing packages:

sudo apt-update

Then, let’s install the required packages with apt:

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

After that, lets add the GPG Key of the official Docker repository to our system:

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

And finally. lets add the Docker repository to our APT sources:

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

Installing Docker on Ubuntu 22.04

Lastly, to install Docker on our Ubuntu 22.04 system, let’s do a final update:

sudo apt update

And to install the latest version of Docker and not the version of the default Ubuntu repository:

apt-cache policy docker-ce

sudo apt install docker-ce

That’s it! You have now successfully installed docker on our system.

Verify

To verify the installation:

sudo systemctl status docker
output

docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-07-01 1:10:45 UTC; 15s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1854 (dockerd)
      Tasks: 7
     Memory: 30.3M
        CPU: 240ms
     CGroup: /system.slice/docker.service
             └─7854 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Summary

This short guide showed you how to install Docker on Ubuntu 22.04.

Leave a Comment