How to install Docker on Ubuntu 22.04

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. We already know that Ubuntu 22.04 has been released and so many sysadmins are preparing to upgrade their systems or take advantage and deploy others. Today, you will learn how to install Docker on Ubuntu 22.04. This tool is vital to many today.

What is Docker?

Docker is a software development platform for virtualization with multiple operating systems running on the same host. This is made possible by containers that are distributed as images.

The system is very lightweight because it does not incorporate an operating system, which also allows for better use of resources. Docker also allows applications to be isolated, which is very useful for testing without bringing down the client’s production server.

Although Docker is a very complex technology, it can be easily controlled through a series of commands.

Unlike virtual machines that can communicate with the host hardware, Docker containers run in an isolated environment on top of the host operating system.

Installing Docker on Ubuntu 22.04 using the external repository

Once we’re ready, you can update the whole system

sudo apt update
sudo apt upgrade

Thereafter, install some packages needed for Docker installation

sudo apt-get install ca-certificates curl gnupg lsb-release

Then, as we are going to install Docker using the official Docker repositories, we have to download and add the GPG key from this repository.

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

After this, add the Docker repository to the system

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

Now refresh APT so that the package manager recognizes the packages in this new repository.

sudo apt update

Thereafter, we can install Docker on Ubuntu 22.04

sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

After the installation has finished, you can check the version that has been installed on the system

docker --version

You will get an output screen like this

Docker version 20.10.14, build a224086

Managing the Docker service in Ubuntu 22.04

Before using it, it’s good to know that Docker is installed and a service is added to the system with which we can start, stop, restart and check the status.

To start Docker, you can run

sudo systemctl start docker

Or to stop it

sudo systemctl stop docker

When you apply changes to the Docker configuration, you will need to restart Docker to apply the changes. This can be done with the following command.

sudo systemctl restart docker

Finally, you can check the status of the service to know if it is running

sudo systemctl status docker
Docker service status
Docker service status

Testing Docker on Ubuntu 22.04

Docker requires root permissions by default, but we can change this by adding our user to the Docker group.

sudo usermod -aG docker $USER

This way, we will be able to use Docker from our regular user.

The best way to test if Docker is working properly is to run a test image.

The test image is called hello-world.

To run it, just run

docker run hello-world
Docker on Ubuntu 22.04
Docker on Ubuntu 22.04

Docker isready for the work

Conclusion

Docker is an important technology in our world, that is why we have to learn how to install it on a system like Ubuntu 22.04. Now that you know how to install it, you can try it by yourself.

How to install Docker on Debian 11

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook