How to Install Docker on Ubuntu 22.04

Docker helps you to create, test, run, and deploy the applications on the containers which can be run and used anywhere in the world. The readers who are unaware of the term “containers” for them, it is similar to a virtual machine and provides all the tools which are required to run and deploy the applications.

If we talk about the benefits of the Docker platform, then we can say that it is quick and easy to configure, enable high productivity, and can run multiple applications on different containers on the same hardware machine.

This guide is about the installation of Docker on the latest release of Ubuntu which is either known as 22.04 or Jammy Jellyfish.

How to install Docker on Ubuntu 22.04

There are three ways to install the Docker on Ubuntu:

  • From the default repository of Ubuntu
  • By downloading the Debian package
  • By importing the GPG key

Method 1: How to install Docker on Ubuntu 22.04 through the default repository

The package Docker comes in the default repository of Ubuntu, to confirm this, we will check the availability of Docker’s package in a repository using the command:

$ sudo apt show docker

To install this package of Docker, we will use the install option with the apt package manager command:

$ sudo apt install docker -y

We will delete the docker because we want to show another method of installation of Docker:

$ sudo apt purge docker -y

Method 2: How to install Docker by downloading the Debian package

Another method to install the Docker on Ubuntu is by downloading the Debian package of Docker from its official website by using either wget command or curl command, but here we will use the wget command:

$ wget -c https://desktop.docker.com/linux/main/amd64/docker-desktop-4.8.1-amd64.deb

The next step is to list down the contents to confirm the download of the Deb package of Dockers:

$ ls

To install the Deb package of Docker, we will use the dpkg package manager:

$ sudo dpkg -i docker-desktop-4.8.1-amd64.deb

Now again remove the package by using the purge command along with all its configuration files:

$ sudo apt purge docker-desktop -y

Method 3: How to install Docker on Ubuntu 22.04 using the gpg key

The Last method of the installation of Docker in this guide is by importing the GPG key of Docker, for this, we will first import the GPG key of Docker from its official website by using the curl command:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Next is to add up the repository of Docker in the default repository of Ubuntu using the command:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Update the packages and repositories of Ubuntu using the command:

$ sudo apt update

Install docker from the imported repository using the command:

$ sudo apt install docker-ce docker-ce-cli containerd.io

Confirm the installation by checking the status of Docker using the systemctl command:

$ sudo systemctl status docker

Conclusion

Docker helps you to build, run, and deploy multiple applications on the same hardware machine by using multiple containers which work similarly to virtual machines. In this guide, Docker is installed by three different methods in which the simple one is by installing it from the apt repository but if you want to download the latest version of Docker then follow the other two methods.