| by Arround The Web | No comments

Install Docker on Ubuntu 24.04

In the current era, Docker is an indispensable tool for developers to improve productivity. Docker is an application that allows packaging and running applications in an isolated environment. The isolated environment is the container; you can have multiple containers in one host.
This post guides you on steps to follow to get Docker installed on Ubuntu 24.04 quickly.

How to Install Docker on Ubuntu 24.04 (Noble Numbat)

Installing Docker on Ubuntu 24.04 is easy. You only need access to a user account with admin privileges and connected to the internet. Again, the steps to follow will differ depending on your installation method.
In this case, we have two methods of installing Docker on Ubuntu 24.04. Let’s discuss each in detail.

Method 1: Install Docker from Its Official Repository

There are numerous benefits to installing the latest stable Docker version, including access to new features. For someone looking to have the latest Docker version installed, you must access it from the official Docker repository.
However, this method requires running more commands than the second method in the next section. Nonetheless, let’s go through the process step-by-step.

Step 1: Update the Repository
To ensure we prepare our system to retrieve the latest packages, run the below command to update the repository.

$ sudo apt update

update-ubuntu-24.04
You will be required to authenticate the process by adding your root password.

Step 2: Install Prerequisites
Before installing Docker, other prerequisite packages must be installed. For instance, we need the curl utility to download the GPG key.
The below command handles the installation of all the prerequisite packages.

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Step 3: Add Docker’s GPG Key
Using curl, we must add the Docker repository GPG key. Doing so ensures that we can use the key to check the authenticity of the software package before installing it.
Add it using the following command.

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

Step 4: Include the Docker Repository in your APT Sources
When you run the install command, Ubuntu checks the sources list to fetch a package. Thus, we must add Docker’s repository to the system’s source list with the below command.

$ 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


After adding the Docker repository, run the update command to refresh the sources list.

$ sudo apt update

Step 5: Verify the Installation Source
As a last step before installing Docker, use the below command to specify that the system should source the Docker repository that we’ve added and not the one available on the Ubuntu repository. This way, you will access the latest Docker version.

$ apt-cache policy docker.ce

From the output, you will see the latest available version for your system.

Step 6: Install Docker
At this point, we can install Docker from the official repository by running the below command.

$ sudo apt install docker-ce -y

Step 7: Verify the Installed Docker
One way of ascertaining that we’ve successfully installed Docker on Ubuntu 24.04 is to check its status using systemctl. Use the following command.

$ sudo systemctl status docker


Another way to check that the installation succeeded is by running the hello-image. Docker offers the image to ascertain that the installation was completed successfully. Running the command will pull the image and run the test.
Here’s the command to run.

$ sudo Docker run hello-world


Go ahead and have fun using Docker!

Method 2: Install Docker from the Ubuntu Repository

Docker is also available from the official Ubuntu 24.04 repository. This option is the easy way to install Docker, but you won’t get the latest version.
Nonetheless, you still manage to get Docker. Proceed as follows.

Step 1: Update Ubuntu’s Repository
Similar to the previous method, we must update the Ubuntu repository before installing Docker.

$ sudo apt update

Step 2: Fetch and Install Docker
After the update, we can install Docker using the command below.

$ sudo apt-get install docker.io -y


Allow the installation to compete.

Step 3: Install Docker Dependencies
Although we’ve managed to install Docker, some dependency packages should be installed. Instead of installing them separately using APT, a better way is to install Docker as a snap package.
Doing so will install all the Docker dependencies when installing the snap package. Run the snap install command below.

$ sudo snap install Docker


Bingo! You’ve installed Docker on Ubuntu 24.04 from the Ubuntu official repository. You can check the Docker version to verify that it is installed and ready for use.

Conclusion

Docker is a new and reliable way of packaging and running applications in containers. The benefits of using Docker are numerous for a developer, and it all starts with knowing how to install it. This post gave a step-by-step process for installing Docker on Ubuntu 24.04. Hopefully, you’ve managed to get Docker up and running.

Share Button

Source: linuxhint.com

Leave a Reply