Step-by-Step Guide: How to Install Docker on Ubuntu 24.04

Install Docker on Ubuntu

This tutorial is more focused on How to Install Docker On Ubuntu 24.04 Operating System. If you are looking for a guide on How to Install Ubuntu 24.04 ? Here is a quick tutorial on the OS Installation.

What is Docker ?

Docker is one of the most widely used Open-Source Container virtualization platform that simplifies the deployment and management of applications using portable containers. A Docker container is nothing but a standard software unit that packages everything needed to run a application code, runtime, libraries, environment variables and configurations. This is approach also ensures that the application is consistent and runs across different computing environments.

Benefits of Using Docker:

  • Portability: Since the entire application and its related components are packaged together, they can literally run on any machine with Docker Software installed.
  • Isolation: Most of the time, the containers we deploy are isolated from one another and also with the host system where the docker is installed. This ensures security and stability to the system as well as the application.
  • Efficiency: Each of the container that is being installed and managed share the OS Kernel, this makes them very light and faster than the traditional Virtual machines.
  • Scalability: Docker supports horizontal Scaling, making it very easy to deploy and manage multiple container instances.

Pre-requisites for Installing Docker on Ubuntu 24.04

Below are some of the pre-requisite for installing Docker on Ubuntu 24.04

  • Ubuntu 24.04 Virtual Machine or a VPS
  • A root user or any user with Sudo Privileges to the system.

How to Install Docker on Ubuntu 24.04 ?

So, without much of a fuss, let us get started on Installing Docker on our Ubuntu Operating System.

Step 1: Update the System

The very first step when you have the fresh system is to update the packages and install the necessary dependencies for the system. To do that, Issue the below command.

sudo apt update

The above command will make sure that all the packages in the systems are updated and ready for our docker installation. now the next command is to install the necessary dependencies for us to install our docker software smoothly, To do that, Issue the below command

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

the above command ensures that all the dependency packages required to Install Docker on Ubuntu 24.04 is now complete. Now let us proceed to install Docker.

Step 2: Docker Installation

The very first step to install docker is to download the Docker GPG key using the curl command as shown below.

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

The very next step is to add the docker apt repository to your system, the below command creates the necessary repository files in 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, let us issue the update command once again so that our package manager notify the system for the newly added docker repository, to do so, issue the following command.

sudo apt update

Step 3: Install Docker

The next step is to install docker community edition on our system. Issue the following command and wait for it to complete.

sudo apt install docker-ce -y

Wait for the above command to do its magic, once completed the Docker service will start automatically. You can verify its status using the below command.

sudo systemctl status docker

Step 4: Add user to Docker group

Using the default installation, only the root or the sudo privileged user will be able to issue the docker commands. When you run the docker commands as a normal user will result in ‘Permission denied’ Error message.

What we can do is, we can add the regular user that will operate docker commands to the docker group. this will ensure that there is no need to invoke docker commands with sudo or we do not need a root user to manage docker containers. To do so, issue the following commands.

To add the current user to the docker group.

sudo usermod -aG docker $USER

Next, runt the newgrp command for refresh.

newgrp

You can now, verify that the new user has been added to the docker group using the following command.

groups <your_user_name>

Step 5: Validate the Docker Installation

To validate whether our docker installation is perfect and we are able to run the docker commands as the normal user, issue the below command.

docker version

The above command will print the detailed version of your docker installation. If it does, Voila !!! you are able to Successfully Install Docker on the Latest Ubuntu 24.04 Operating System.

Summary

In short, In this tutorial we have seen how to install Docker on Ubuntu 24.04, the Latest release from the canonical team at the time of writing this article.

Leave a Reply

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