How To

Install Docker on Ubuntu 24.04 With Easy Setup Guide

Docker has become one of the most important tools in modern software development. If you want to Install Docker on Ubuntu systems for containerized applications, setting it up correctly from the official repository is the safest approach. Docker allows developers to build, test, and deploy applications in isolated environments called containers, making deployments faster and more consistent.

Unlike traditional virtual machines, Docker containers use fewer system resources and start almost instantly. As a result, developers, DevOps teams, and cloud engineers rely on Docker for everything from local testing to production deployments.

Why Install Docker Ubuntu From the Official Repository

Ubuntu includes Docker packages in its default repositories. However, those versions are sometimes outdated. Therefore, installing Docker from Docker’s official repository ensures you receive the latest features, bug fixes, and security updates.

Before starting, make sure your system meets these requirements:

  • Ubuntu 24.04 or another supported release
  • 64-bit architecture
  • Internet connection
  • User account with sudo privileges

It is also recommended to remove any old Docker-related packages before proceeding.

sudo apt remove docker.io docker-doc docker-compose podman-docker containerd runc

Install Docker on Ubuntu Using APT Repository

First, update your package list and install the required dependencies.

sudo apt updatesudo apt install ca-certificates curl

Next, create the Docker keyring directory and download Docker’s official GPG key.

sudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc

After that, add Docker’s official repository to Ubuntu.

sudo tee /etc/apt/sources.list.d/docker.sources <<EOFTypes: debURIs: https://download.docker.com/linux/ubuntuSuites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")Components: stableArchitectures: $(dpkg --print-architecture)Signed-By: /etc/apt/keyrings/docker.ascEOF

Now refresh the package database and install Docker Engine.

sudo apt updatesudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify Install Docker Ubuntu Setup

Once installation finishes, check whether Docker is running properly.

sudo systemctl status docker

You can also verify the installed Docker version.

sudo docker version

To confirm Docker can download and run containers successfully, execute the test container below.

sudo docker run hello-world

If everything works correctly, Docker will pull the test image and display a confirmation message.

Run Docker Without sudo

By default, Docker commands require sudo access. Fortunately, Ubuntu lets you grant Docker permissions to your user account.

sudo usermod -aG docker $USER

Then apply the new group changes:

newgrp docker

Afterward, test Docker again without sudo.

docker run hello-world

Common Docker Maintenance Commands

Keeping Docker updated is important for security and performance.

Update Docker packages:

sudo apt updatesudo apt upgrade

Remove unused Docker resources:

docker system prune -a

Uninstall Docker completely if needed:

sudo apt purge docker-ce docker-ce-cli containerd.io

Conclusion

Choosing to Install Docker on Ubuntu systems from the official Docker repository gives you access to the latest stable releases and security improvements. In addition, Docker simplifies application deployment, improves development workflows, and supports modern DevOps practices. Once Docker is installed correctly, you can start building containers, deploying services, and managing scalable applications with ease.

Cyber Defence

Recent Posts

Install Samba on Ubuntu 18.04: Configure Shares and User Access

Samba is a free, open-source implementation of the SMB/CIFS network protocol that lets Linux servers share…

13 hours ago

Set Up an OpenVPN Server on Ubuntu 18.04 with EasyRSA and UFW

Running your own VPN gives you full control over your traffic, privacy, and connection security. It encrypts…

13 hours ago

Install IntelliJ IDEA on Ubuntu 18.04 via Snap: Setup Guide

IntelliJ IDEA is a full-featured IDE for JVM and Android development made by JetBrains. It includes…

13 hours ago

Install Steam on Ubuntu 18.04: Multiverse Setup and First Run

Steam is a cross-platform digital distribution platform by Valve Corporation that gives you access to thousands…

13 hours ago

Install Redmine on Ubuntu 18.04 with MySQL, Passenger, and Nginx

Redmine is one of the most popular open-source project management and issue tracking platforms. It is…

14 hours ago

Install VirtualBox on Ubuntu 18.04 from the Oracle Repository

VirtualBox is a free, open-source, cross-platform virtualization application maintained by Oracle. It lets you run multiple…

2 days ago