Docker is a software platform for developing applications based on Containers (lightweight execution environments) that share the operating system kernel but in isolation. In Unix and Linux-based systems, Containers have been utilized for some time, however, when Docker was deployed in the market in 2013, it became easier for the developers to bundle their applications in such a way that it is created once and can be executed anywhere.

This write-up will discuss the procedure to install Docker on Ubuntu 22.04. So, let’s start!

How to install Docker on Ubuntu 22.04

You must follow the below-given step-by-step instructions for installing Docker on Ubuntu 22.04.

Step 1: Update system repositories


Press “CTRL ALT T” to open the terminal of your Ubuntu 22.04 and run the below-given commands to update system repositories:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-1.png" data-lazy- height="390" src="data:image/svg xml,” width=”838″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-2.png" data-lazy- height="294" src="data:image/svg xml,” width=”834″>

Step 2: Install required dependencies


After updating the system packages, next step is to install required dependencies for Docker:

$ sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-3.png" data-lazy- height="581" src="data:image/svg xml,” width=”823″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-4.png" data-lazy- height="578" src="data:image/svg xml,” width=”819″>

Step 3: Adding Docker repository to system sources


When Docker repository is added to the system sources, it makes the Docker installation easier and provides faster updates.

To add the Docker repository to the system sources, first, import the Docker GPG key required for connecting to the Docker repository:

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-5.png" data-lazy- height="313" src="data:image/svg xml,” width=”818″>

Then, execute the following command for adding the Docker repository to your Ubuntu 22.04 system sources list:

$ 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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-6.png" data-lazy- height="328" src="data:image/svg xml,” width=”816″>

Step 4: Update system packages


After adding Docker repository to the system sources, again update the system packages:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-7.png" data-lazy- height="497" src="data:image/svg xml,” width=”823″>

Step 5: Install Docker on Ubuntu 22.04


If you have carefully followed the previously given steps, then at this point, your Ubuntu 22.04 system is all ready for the Docker installation:

$ sudo apt install docker-ce

Note that we are utilizing the “docker-ce” package instead of “docker-ie” as it is supported by the official Docker repository:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-8.png" data-lazy- height="579" src="data:image/svg xml,” width=”818″>

Enter “y” to permit the Docker installation to continue:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-9.png" data-lazy- height="575" src="data:image/svg xml,” width=”810″>

The below-given error-free output indicates that Docker is successfully installed on our Ubuntu 22.04 system:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-10.png" data-lazy- height="585" src="data:image/svg xml,” width=”820″>

Step 6: Verify Docker status


Now, execute the below-given “systemctl” command to verify if the Docker is currently active or not on your system:

$ sudo systemctl status docker

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-11.png" data-lazy- height="581" src="data:image/svg xml,” width=”822″>

How to use Docker on Ubuntu 22.04

After installing Docker on Ubuntu 22.04, you can use it to download and run any test container. For instance, the following will download the “hello-world” Docker test container:

$ sudo docker run hello-world

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-12.png" data-lazy- height="617" src="data:image/svg xml,” width=”820″>

Then, execute the “docker ps” command with the “-a” command to display the information related to running Docker containers:

As you can see in the below-given output, the “hello-world” container is added successfully:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-13.png" data-lazy- height="227" src="data:image/svg xml,” width=”1130″>

How to uninstall Docker from Ubuntu 22.04

Want to uninstall Docker from your Ubuntu 22.04 system? If yes, then write out the following command in the terminal:

$ sudo apt-get purge docker-ce

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/How-to-Install-Docker-14.png" data-lazy- height="619" src="data:image/svg xml,” width=”896″>

We have compiled the simplest method to install and use Docker on Ubuntu 22.04 system.

Conclusion

For the installation of Docker on Ubuntu 22.04, first, update the system repositories with the “$ sudo apt update” command and install the required dependencies. After that, import the Docker GPG key and add its repository to the system sources. Then, install Docker with the help “$ sudo apt install docker-ce” command. This write-up discussed the method to install Docker on Ubuntu 22.04.

About the author

<img alt="" data-lazy-src="https://secure.gravatar.com/avatar/c73b74cd8044d2e9b300610f5af77d0b?s=112&r=g" data-lazy- height="112" src="data:image/svg xml,” width=”112″>

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.