How to Install Docker on Ubuntu 24.04

When you start working with containers, Docker is usually the first tool you need. Most modern server software ships as container images, CI/CD pipelines build and test code inside containers, and many self-hosted applications only document a Docker-based setup.
Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers. A container packages a single application together with all the software components and dependencies it needs, so it runs the same way on a local development machine, a test environment, or a cloud server.
This tutorial explains how to install Docker on Ubuntu 24.04 from the official Docker repository, verify that it works, and set up your user to run Docker commands without sudo.
Quick Reference
For a printable quick reference, see the Docker cheatsheet .
If you have installed Docker before and only need the commands, these are the core installation steps:
sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc
sudo apt update
sudo apt install ca-certificates curl
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.asc
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
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-worldThe hello-world container confirms that Docker can download an image and start a container. The rest of this guide breaks the commands down step by step and covers non-root access, Docker Compose, updates, and uninstalling.
Supported Ubuntu Versions
Docker is available for installation from the standard Ubuntu repositories as the docker.io package, 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 26.04 LTS (Resolute)
- Ubuntu 25.10 (Questing)
- 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
-p or --publish, review Docker’s firewall documentation
.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, and on Ubuntu 26.04 it returns resolute.
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.6.1-1~ubuntu.24.04~noble amd64
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
...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
By default, only root and a user with sudo privileges can run Docker commands.
docker group grants root-level privileges. On shared systems, continue using sudo or configure Docker rootless mode
instead.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-worldDocker Compose
The docker-compose-plugin package installed in Step 4 provides Docker Compose
, so there is no need to install Compose separately. Confirm that the plugin is available:
docker compose versionDocker Compose version v5.3.1Compose is invoked as docker compose, with a space. The old standalone docker-compose binary is deprecated and should not be used on new installations.
Updating Docker
When a new Docker version is released, update it using standard system commands:
sudo apt update
sudo apt upgradeTo prevent only the Docker Engine package from being upgraded, mark docker-ce as held:
sudo apt-mark hold docker-ceUninstalling Docker
If you want a clean removal, stop all running containers and remove all containers, images, volumes, and networks :
docker container ls -aq | xargs -r docker container stop
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}Finally, remove the Docker repository configuration and signing key:
sudo rm -f /etc/apt/sources.list.d/docker.sources /etc/apt/keyrings/docker.ascTroubleshooting
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.
FAQ
What is the difference between docker.io and docker-ce?docker.io is the Docker package that Ubuntu maintains in its own repositories, and it usually lags several releases behind. docker-ce is the official package from Docker, published as soon as a new version is released. Both provide Docker Engine; this guide installs docker-ce.
Does this guide install Docker Desktop?
No. This guide installs Docker Engine, which runs containers directly on your system. Docker Desktop is a separate product that bundles Docker Engine with a graphical interface inside a virtual machine and is aimed at development workstations. On servers, Docker Engine is what you want.
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 . When you are ready to build your own images, start with our Dockerfile 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