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

Install Docker effortlessly on Ubuntu 24.04 LTS (Noble Numbat) with our expert, easy-to-follow guide. Perfect for beginners and pros alike.

Docker is a powerful tool for creating, deploying, and managing containers, making it easier and time-saving to run applications in a consistent environment. At the same time, Ubuntu is a great and reliable platform, suitable both for development and as a server you can trust for your Docker needs.

Whether you’re a developer eager to containerize your applications or just curious about Docker and its capabilities, you’ve come to the right place. We crafted this guide to help you smoothly install Docker on your Ubuntu 24.04 LTS system, ensuring you can start containerizing your applications quickly.

Just follow the steps outlined below. We’ve thoroughly tested and proven each one to ensure they provide you with the best and most effective solution.

Installing Docker on Ubuntu 24.04 LTS (Noble Numbat)

We’ll start with a clarification—there are several ways to install Docker on Ubuntu 24.04. The most straightforward one is to install it from the Ubuntu repos with a single APT command. However, the main drawback to this approach is that the version available is not always the most recent.

For this reason, this guide will show you how to install Docker on Ubuntu 24.04 from its official repository, where you will always get the latest version.

The best part? It will automatically receive all future software updates as they become available, thus ensuring you always have the latest and greatest. So, let’s get started!

Step 1: Install Required Packages

First, run the two commands below to update the package index and install the prerequisite necessary for adding the new Docker repository, which we will do in a moment.

sudo apt update
sudo apt install apt-transport-https curlCode language: Bash (bash)

Step 2: Add Docker’s Official GPG Key

Next, import the Docker GPG repository key to your Ubuntu system. This security feature ensures that the software you’re installing is authentic.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgCode language: Bash (bash)
Add Docker’s official GPG key.
Add Docker’s official GPG key.

Step 3: Set Up Docker’s Stable Repository

After importing the GPG keys, we’ll add the official Docker repository to our Ubuntu 24.04 LTS system. This implies that the update package will be made available with the rest of your system’s regular updates if a new version is released.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullCode language: Bash (bash)
Add the official Docker repository to Ubuntu 24.04 LTS.
Add the official Docker repository to Ubuntu 24.04 LTS.

As with the previous command, its execution produces no output. Next, refresh the package list.

sudo apt updateCode language: Bash (bash)
Update the package base.

As you can see, our new Docker repository is now available and ready to be used.

Step 4: Install Docker Engine on Ubuntu 24.04 LTS

Run the below command to install the latest up-to-date Docker release on Ubuntu.

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginCode language: Bash (bash)
Install Docker on Ubuntu 24.04 LTS (Noble Numbat).
Install Docker on Ubuntu 24.04 LTS (Noble Numbat).

This installs the following Docker components:

  • docker-ce: The Docker engine itself.
  • docker-ce-cli: A command line tool that lets you talk to the Docker daemon.
  • containerd.io: A container runtime that manages the container’s lifecycle.
  • docker-buildx-plugin: This extension for Docker enhances the capabilities of building images, mainly focusing on multi-platform builds.
  • docker-compose-plugin: A configuration management plugin that helps manage multi-container Docker applications using a single YAML file.

That’s all! Docker should now be installed, service enabled, and set to start automatically on boot. In addition, check its status using the command below to confirm that everything is as expected:

sudo systemctl is-active dockerCode language: Bash (bash)
Check the status of the Docker service.
Check the status of the Docker service.

Step 5: Verify Installation

The moment of truth. Let’s check if our new Docker installation works correctly by running a simple containerized application called “hello-world.”

sudo docker run hello-worldCode language: Bash (bash)
Docker successfully installed, up & running on Ubuntu 24.04 LTS.
Docker successfully installed, up & running on Ubuntu 24.04 LTS.

Congratulations! As we can see, everything works properly.

Enabling Non-root Users to Run Docker Commands

So far, you have successfully installed Docker on your Ubuntu 22.04 LTS system. However, only root and users with sudo privileges can execute Docker commands by default.

That means if you attempt to run the docker command without prefixing it with sudo, you’ll get an error message like this:

Docker permission denied.
Docker permission denied.

But there is no room for worry. To run Docker commands as a non-root user, add your user to the “docker” group. To do that, type in the following:

sudo usermod -aG docker ${USER}

In the above command, “${USER}” is an environment variable that contains your username. To apply for the new group membership, reboot your Ubuntu system. You can then execute docker commands without prefixing them with sudo.

Run the docker command as a regular user.
Run the docker command as a regular user.

Uninstall Docker Engine

If, for some reason, you decide to remove Docker from your Ubuntu 24.04 system, run the following command first:

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extrasCode language: Bash (bash)

Then, manually remove the following two directories:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerdCode language: Bash (bash)

Conclusion

Following our guide’s steps, you now have Docker successfully installed on your Ubuntu 24.04 LTS system. You’re all set and well-equipped to get on with your Docker projects.

To learn more about Docker, I highly recommend checking out its official documentation.

As always, if you encounter any issues or have questions, let me know in the comments section below. Thank you for following this tutorial, and happy Dockerizing!

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%