How to Install Docker on Ubuntu 24.04

How to Install Docker on Ubuntu 24.04


Docker is the system administrators' and developers' go-to tool for needing speed and consistency in app deployment. Instead of having to deal with endless dependencies or wrestle with different environments, Docker allows you to just neatly package everything into containers.

Ubuntu 24.04 is the latest long-term support (LTS) release, and as always, a couple of things have changed since older guides were created using 20.04 or 22.04. If you've tried to follow an old tutorial and are suffering from strange errors, don't worry — this guide will walk you through a new install of Docker onto Ubuntu 24.04 from start to finish.

Most tutorials available online are outdated — tied to Ubuntu 20.04 or 22.04. This is why this new guide to 24.04 matters: it saves you the disappointing inconsistencies and errors.



System Requirements for Docker on Ubuntu 24.04


Docker itself is lightweight, but the applications you run inside it might not be. A minimal setup could be:

   CPU: 1 core (more cores = faster builds and smoother containers)
   RAM: 1–2 GB for small projects, 4 GB+ if you plan to run databases or heavier workloads
   Disk: 10 GB free space at minimum, preferably on SSD or NVMe

A VPS or dedicated server is perfect for running Docker — you get root access, stable performance, and flexibility to scale when your projects grow. If you want an easy starting point, check out our Linux VPS plans.



Step 1: Update Your System


Before installing anything new, always refresh your package lists and upgrade the base system. This avoids conflicts later.

sudo apt update && sudo apt upgrade -y

Keeping your Ubuntu 24.04 fresh is the first step to making sure Docker installs smoothly.

Once that finishes, it’s a good idea to reboot if the kernel was updated:

sudo reboot



Step 2: Install Required Dependencies


Install the packages needed for secure downloads and key management:

sudo apt install ca-certificates curl gnupg -y

These ensure your system can download Docker securely from its official repositories.



Step 3: Add Docker’s GPG Key and Repository


Create a keyrings directory and add Docker’s official GPG key:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg


Now add the Docker repository:

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



Step 4: Install Docker Engine


Update the package index again and install Docker:

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


Check the version to confirm installation:

docker --version



vikhost vps

Virtual Server

BUY LINUX VPS SERVER NOW!

$5.99 /month




Step 5: Run Docker Without Root (Optional but Recommended)


By default, Docker requires sudo. To avoid this, add your user to the Docker group:

sudo usermod -aG docker $USER


Log out and log back in (or restart your session). You’ll now be able to run Docker commands without sudo:

docker ps



Step 6: Enable and Start Docker


Enable Docker to start on boot and start it manually:

sudo systemctl enable docker
sudo systemctl start docker


Check its status:

sudo systemctl status docker



Step 7: Test Docker with Hello World


Run the official test container:

docker run hello-world

If you see a friendly success message, Docker is installed correctly ✅



Why Use Docker on a VPS?


Docker is very convenient on virtual servers. Instead of having all your apps ruin one environment, you can segment them neatly: one container for your database, another for your Node.js app, and a third for a layer of caching. If something fails, you swap out the failed container, not the whole system.

And since VPS hosting gives you root access and manipulable resources, you can scale containers up and down based on growing projects.

Docker is simple to host on a VPS, cheap, and handy. If you need harder loads or even production, you can have a High-Performance VPS and get more resources thrown in straight away.



Conclusion


Installing Docker on Ubuntu 24.04 isn't tough — but the details matter. Using the official repo, with the correct GPG key, and formatting permissions, you set yourself up with a clean environment that operates beautifully out of the box.

Whether running tests against applications or heading out to run production workloads, Docker on Ubuntu 24.04 offers the best balance of speed and reliability. If you dislike waiting for manual configuration, running Docker in a VPS saves you time and enables you to focus on construction instead of debugging.

Installing Docker on Ubuntu 24.04 FAQs

You ask, and we answer! Here are the most frequently asked questions!