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

Why Deploying AI Is Just the Beginning: The Case for Ongoing AI Operations Monitoring

Most enterprise AI programs treat deployment as the destination. The business case is built around…

8 hours ago

Bash Scripting Best Practices Every Beginner Should Know

Introduction Bash scripting is a powerful way to automate Linux tasks, but writing a script…

5 days ago

How To Create A Self-Signed SSL Certificate Using Bash And OpenSSL

Introduction A self-signed SSL certificate is a certificate that is created and signed by the…

5 days ago

How To Debug Bash Scripts Using bash -x And set Commands

Introduction Debugging is an important part of Bash scripting. When a script does not work…

5 days ago

How To Use Cron Jobs With Bash Scripts For Automation

Introduction Cron jobs are used in Linux to run commands or Bash scripts automatically at…

6 days ago

How To Use Pipes In Bash Scripts For Command Chaining

Introduction Pipes are an important feature in Linux and Bash scripting. A pipe allows you…

6 days ago