How to Install Docker on Ubuntu 24.04

Docker is a highly versatile open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers. These containers can run anywhere (from local development machines to cloud-based servers).
A container represents a runtime for a single application and includes all the software components and dependencies required for the application to run smoothly. Containers are isolated from the host operating system, ensuring consistency across environments.
Docker is an integral part of modern software development and DevOps continuous integration and deployment (CI/CD) pipelines.
This tutorial explains how to install Docker on Ubuntu.
Supported Ubuntu Versions
Docker is available for installation from the standard Ubuntu repositories, but those packages are often outdated. To ensure you get the latest stable version, we will install Docker from the official Docker repository.
At the time of writing, the Docker repository provides packages for the following Ubuntu versions:
- Ubuntu 25.10 (Questing)
- Ubuntu 25.04 (Plucky)
- Ubuntu 24.04 LTS (Noble Numbat)
- Ubuntu 22.04 LTS (Jammy Jellyfish)
Prerequisites
Before you begin, make sure that:
- You are running a 64-bit supported Ubuntu version
- You have a user account with sudo privileges
- Your system is connected to the internet and up to date
Uninstall any old or conflicting Docker packages first to avoid any potential issues:
sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runcInstalling Docker on Ubuntu
Installing Docker on Ubuntu is relatively straightforward. We will enable the Docker repository, import the repository GPG key, and install the Docker packages.
Step 1: Update the Package Index and Install Dependencies
First, update the package index and install packages required to use repositories over HTTPS :
sudo apt update
sudo apt install ca-certificates curlStep 2: Import Docker’s Official GPG Key
Add Docker’s official GPG key so your system can verify package authenticity:
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.ascStep 3: Add the Docker APT Repository
Add the Docker repository to your system:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") reads your Ubuntu codename from the OS release file. For example, on Ubuntu
24.04 it returns noble.
Step 4: Install Docker Engine
Now that the Docker repository is enabled, update the package index and install Docker:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginInstalling a Specific Docker Version (Optional)
If you want to install a specific Docker version instead of the latest one, first list the available versions:
sudo apt update
apt list --all-versions docker-ceThe available Docker versions are printed in the second column:
docker-ce/noble 5:29.4.0-1~ubuntu.24.04~noble amd64
docker-ce/noble 5:29.3.1-1~ubuntu.24.04~noble amd64
docker-ce/noble 5:29.3.0-1~ubuntu.24.04~noble amd64
...Install a specific version by adding =<VERSION> after the package name.
For example, set a variable from the version list and then install it:
DOCKER_VERSION="<VERSION>"
sudo apt install docker-ce=$DOCKER_VERSION docker-ce-cli=$DOCKER_VERSION containerd.io docker-buildx-plugin docker-compose-pluginReplace <VERSION> with the exact version string returned by apt list --all-versions docker-ce.
Verify the Docker Installation
On most Ubuntu systems, the Docker service starts automatically after installation. If it does not, start it manually:
sudo systemctl start dockerCheck the service status:
sudo systemctl status dockerThe output will look something like this:
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Active: active (running)
...You can also confirm that the client and daemon are responding:
sudo docker versionTo verify that Docker can pull and run containers correctly, run the test image:
sudo docker run hello-worldIf the image is not found locally, Docker will download it from Docker Hub, run the container, print a “Hello from Docker” message, and exit.

The container stops after printing the message because it has no long-running process.
Run Docker Commands Without sudo (Highly Recommended)
By default, only root and a user with sudo privileges can run Docker commands.
To allow a non-root user to execute Docker commands, add the user to the docker group:
sudo usermod -aG docker $USER$USER is an environment variable
that holds the currently logged-in username. If you want to execute commands with another user, replace $USER with that username.
Run newgrp docker or log out and log back in for the group membership changes to take effect.
After that, you can rerun the test container without sudo
:
docker run hello-worldUpdating Docker
When a new Docker version is released, update it using standard system commands:
sudo apt update
sudo apt upgradeTo prevent Docker from being updated automatically, mark it as held:
sudo apt-mark hold docker-ceUninstalling Docker
Before uninstalling Docker, it is recommended to remove all containers, images, volumes, and networks :
Run the following commands to stop all running containers and remove all docker objects:
docker container stop $(docker container ls -aq)
docker system prune -a --volumes -fRemove Docker packages:
sudo apt purge docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo apt autoremoveTo completely remove Docker data from your system, delete the directories that were created during the installation process:
sudo rm -rf /var/lib/{docker,containerd}Troubleshooting
Permission denied while trying to connect to the Docker daemon socket
Your user is not yet in the docker group, or the group membership has not taken effect. Run sudo usermod -aG docker $USER, then log out and back in (or run newgrp docker).
Cannot connect to the Docker daemon. Is the daemon running?
The Docker service is not running. Start it with sudo systemctl start docker and check its status with sudo systemctl status docker.
Package ‘docker-ce’ has no installation candidate
The Docker repository was not added correctly. Re-run Steps 2 and 3, then run sudo apt update before installing.
Conclusion
Installing Docker from the official repository ensures you always have access to the latest stable releases and security updates. For post-install steps such as configuring log drivers or setting up rootless mode, see the official post-install guide .
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page