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

In this blog post, we will explain how to install docker on Ubuntu 24.04 step-by-step.

Docker provides container run time environment which allow developers to build, share and package the application inside a container. This container will have all the libraries, system tools along with the code, later using this container we can quickly deploy the application. System on which we install docker is known as docker engine.

Prerequisites

  • Pre-Install Ubuntu 24.04 LTS
  • Regular User with sudo rights
  • 2 GB RAM and Dual core processor
  • Internet Connectivity

1) Add Docker Official GPG Key

To install latest docker on Ubuntu 24.04 LTS, first we need to add docker docker repository GPG key using below set of commands. So, start the terminal and execute these commands one after the another.

$ sudo apt update
$ sudo apt install ca-certificates curl -y
$ sudo install -m 0755 -d /etc/apt/keyrings
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
$ sudo chmod a+r /etc/apt/keyrings/docker.asc

Add-Docker-Official-GPG-Key-Ubuntu-24-04

2) Add Docker Official APT Repository

After Installing docker gpg key, add its official apt repository by running the following echo command.

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Add-Docker-Official-APT-Repository-Ubuntu-24-04

3) Install Docker on Ubuntu 24.04

As we have enabled the docker official apt repository, so we are good to start the docker installation. Run following apt command to install latest version of docker on your Ubuntu 24.04 system.

$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Install Docker on Ubuntu 24..04

Once docker and its dependencies are installed then add your local user to docker group so that local user can run docker command with sudo.

$ sudo usermod -aG docker $USER
$ newgrep docker
$ docker --version

Add-Local-User-Docker-Group-Ubuntu-24-04

Verify the docker service status,

$ systemctl status docker

Docker-Service-Status-Ubuntu-24-04

Whenever we install docker then it’s service should be started automatically, in case docker service is not running then execute following to start its service.

$ systemctl start docker

4) Test Docker Installation

In order to test docker installation, let’s try to spin up a container using hello-world image. Run following docker command.

$ docker run hello-world

Start-Container-hello-world-Image-Ubuntu-24-04

Above highlighted Informational message confirms that our docker installation is working fine.

That’s all from this post, I hope you have found it informative and useful. Feel free to post your queries and feedback in below comments section.

Share on:

I am a Cloud Consultant with over 15 years of experience in Linux, Kubernetes, cloud technologies (AWS, Azure, OpenStack), automation (Ansible, Terraform), and DevOps. I hold certifications like RHCA, CKA, CKAD, CKS, AWS, and Azure.

Leave a Comment