Ubuntu

Install Docker on Ubuntu 22.04

Docker is a containerized tool that allows applications to run inside containers. This tool ensures that the contained software works smoothly on all devices. This is a great way to make users and developers worry less about operating system compatibility and dependencies.

Docker can be downloaded and installed on most other Linux distributions, including Ubuntu 22.04. You may use Docker to install software packages once installed. It is similar to how you would use your distro’s package management to get an app. Using Docker makes a difference because everything is more automated with compatibility, and dependencies are no longer potential problems.

We will demonstrate in this tutorial how to install Docker on Ubuntu 22.04 Jammy Jellyfish distro.

Prerequisites

  • Ubuntu 22.04 Jammy Jellyfish should be installed on your system or in a VirtualBox.
  • You should have “sudo” privileges or log in as a root user.

How To Install Docker on Ubuntu 22.04

You need to perform the following steps to install Docker on Ubuntu 22.04:

Step 1: Update the Packages Repository

Open the command line tool “Terminal” and use the following command to update the system repositories:

$ sudo apt update

Step 2: Download and Install Docker on Ubuntu 22.04

Once the packages repository is updated, use the following command to download and install Docker on Ubuntu 22.04:

$ sudo apt install docker.io

The previous command will automatically download and install all required Docker packages on your system. Press “Y” and then “Enter” to continue the installation.

Step 3: Enable and Start Docker Service

Once the Docker installation is completed, enable and start the Docker service by using these commands:

$ sudo systemctl start docker.service

$ sudo systemctl enable docker.service

You also verify the Docker running service status by using the following command:

$ sudo systemctl status docker.service

The previous output represents the docker service is enabled and running on your system.

Step 4: Verify Docker Installation

You can verify the Docker installation by displaying the installed version information by using the following command:

$ sudo docker version

In the previous output, you can see the installed Docker version.

You can also use an alternative way to view details about currently running docker containers and the Docker configuration options by using the following command:

$ sudo docker info

How To Run Docker Without sudo or root on Ubuntu 22.04

To run the Docker command on the Ubuntu system, you need to log in as a root user or “sudo” privileges. So, you will add the current user account into the Docker’s group to run the docker as a non-root user:

$ sudo usermod -aG docker $USER

Now, reboot your system to apply changes:

$ reboot

How To Use Docker on Ubuntu 22.04

After installing Docker, you can install images with Docker. Moreover, you can search for a specific image.

Search for a Docker “hello-world” Image

To search for a specific application image through Docker, you can use the following command:

$ sudo docker search [image-name]

For example, we want to search for the “hello-world” image. In this case, the previous command will be changed in the following manner:

$ sudo docker search hello-world

As you can see, only one official “hello-world” image is noted in the OFFICIAL column. There are several releases available as well; to learn how they differ from the official image, read their descriptions.

Download and Install Docker Images

For understanding Docker, we’ll set up the hello-world package that will verify Docker is successfully downloaded and installed on your system. The following command will tell Docker to download the specified software once you know which image you want to install:

$ sudo docker pull hello-world

The previous output shows that Docker can find and download application images.

Run Docker Image

Once you have downloaded the docker “hello-world” image, you can run it by using this command:

$ sudo docker run hello-world

To verify the proper working of docker, execute the “docker ps” command with the option “-a” to print the information about running docker containers:

$ sudo docker ps –a

The previous output represents that the hello-world docker container is installed successfully. Or you can also run the following command:

$ sudo docker images

How To Uninstall or Remove Docker From Ubuntu 22.04 Distribution

If you don’t want to use Docker on your system, you can uninstall it from Ubuntu 22.04 by using the following command:

$ sudo apt purge docker.io

Conclusion

In this article, we learned how to install Docker on Ubuntu 22.04 Jammy Jellyfish distribution. Docker is a very easy-to-use tool on Ubuntu. You need to learn just Docker commands syntax for more understanding. After reading the information provided, you will be able to install new Docker container images and can search for specific software using the “docker search” command.

 

Similar Posts