How to Install Docker on Ubuntu 24.04?
Docker is an open source software platform that enables the creation, deployment and management of virtualized application containers across a shared operating system. It transformed software development and deployment through its introduction of a standardized method for packaging, distributing and running applications. It delivers its platform as a service (PaaS) offerings by employing OS-level virtualization to package software into units known as containers.
Originally designed for Linux, Docker has evolved to include expanded compatibility with non-Linux systems like Microsoft Windows and Apple OS X. Docker’s cross-platform functionality drives its extensive adoption across various computing environments such as on-premises data centers and public clouds including hybrid setups.
In this blog, you will learn how to install docker on ubuntu 24.04
Pre-Requisites
- An instance of Ubuntu 24. 04 with SSH access.
- A sudo user configured on the server instance.
Installation of Docker
1. Update system and install dependencies
Log into the server and update the package index that is defined in /etc/apt/sources.list file and /etc/apt/sources.list.d/ directory.
sudo apt update
Some dependencies are required for the installation to progress well. So, run the command below to install them.
sudo apt install curl apt-transport-https ca-certificates software-properties-common
Now package lists are updated, and requisite software packages are present, next proceed to install Docker.
2. Install Docker
To install the most current version, you need to install it from the official Docker repository.
Download the Docker GPG key using the curl command below.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Then, add the Docker APT repository to the system. This command creates a docker.list repository file in the /etc/apt/sources.list.d directory.
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
update the local package index to notify the system of the newly added repository.
sudo apt update
Then, install the Docker Community Edition as follows. In the below command, the -y option allows for non-interactive installation.
sudo apt install docker-ce -y
Sample output:
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: containerd.io docker-ce-cli docker-ce-rootless-extras docker-scan-plugin The following NEW packages will be installed: containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin 0 upgraded, X newly installed, 0 to remove and X not upgraded. Need to get XX.X MB of archives. After this operation, XXX MB of additional disk space will be used.
3. Verify the Installation Status
The Docker service starts automatically upon installation. You can verify its status by running the command:
sudo systemctl status docker
Sample Output:
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2025-03-14 10:00:00 UTC; 5min ago Docs: https://docs.docker.com Main PID: 1234 (dockerd) Tasks: 20 Memory: 50M CGroup: /system.slice/docker.service ├─1234 /usr/bin/dockerd -H fd:// ├─1256 containerd
4. Test the docker installation
To test this, we will create a container from the hello-world image.
docker run hello-world
Sample output:
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
Conclusion
The Docker client searched for an image called hello-world on the local system but could not find it. It then contacted Docker Hub, retrieved the image to the local system, and created a new container from that image. The container then streams this output on your terminal and exits. Docker is now installed.