How To Install and Use Docker on Ubuntu 22.04 LTS

Introduction

The application Docker makes it easier to manage application processes in containers. You can run your applications in resource-isolated processes with containers. Containers are similar to virtual machines, but they are more mobile, use fewer resources, and rely more on the host operating system.

In this post, We will know how to install docker on ubuntu 22.04 LTS

Step 1: Update the System

First, update the packages on your current list:

sudo apt-get update

Step 2: Adding Docker Repository and GPG Key

It’s possible that the Docker installation package in the official Ubuntu repository is not the most recent version. We will install Docker from the official Docker repository in order to guarantee that we get the most recent version. We will first add a new source for the package, then install the package by adding the GPG key from Docker to make sure the downloads are legitimate.

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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-get update && sudo apt-cache policy docker-ce 

Step 3: Install Docker Community Edition

We are good to install the docker-ce on ubuntu 22.04 LTS, We need to use the following command.

sudo apt-get install docker-ce -y

Step 4: Verify Docker Service Status

The daemon should now be running, Docker should be installed, and the process should be enabled to start on boot. Verify that it is operating:

sudo systemctl status docker.service

The following should appear in the output to indicate that the service is running:

Step 5: Docker Command Without Sudo

By default, the docker order must be run the root client or by a client in the docker bunch, which is naturally made during Docker’s establishment cycle. You will receive the following output if you attempt to run the docker command without prefixing it with sudo or without being a member of the docker group:

sudo usermod -aG docker ${USER}

To apply the new group membership, log out of the server and back in, or type the following:

Log in log out and apply the new group by execution the given command.

su - ${USER}

To check your user added in docker group.

groups

If wewant to add a user to the docker group that you’re not logged in as, declare that username explicitly using:

sudo usermod -aG docker username

Step 6: Docker System-Wide Info

We need to execute given command, To view system-wide information about Docker.

docker info

Conclusion

We have successfully installed the docker on ubuntu 22.04 LTS machine, If you still have questions, please post them in the comments section below.

Author

How To Install and Use Docker on Ubuntu 22.04 LTS

4 thoughts on “How To Install and Use Docker on Ubuntu 22.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top