How to Install Docker on Ubuntu 24.04
Table of contents
- Key takeaways
- Pre-installation steps
- Add the official Docker repository
- Install the Docker engine
- Configure the Docker daemon
- Verify the installation
- Frequently asked questions
- Do I need Docker Desktop on Ubuntu?
- Why does apt-key add fail on Ubuntu 24.04?
- Do I need to reboot after installing Docker?
- Conclusion
- Sources
Updated: 2026-07-12
Docker is the most widely used container platform. This guide explains how to install it on Ubuntu 24.04 LTS from the official repository, using the GPG key signed under /etc/apt/keyrings and the bundled Compose plugin.
Docker[1] is the most widely used container platform: it lets you build, ship, and run applications in isolated, reproducible environments. This guide explains how to install it on Ubuntu 24.04 LTS from the official repository, using the modern flow with a GPG key signed under /etc/apt/keyrings (the old apt-key add - is retired and won’t work on 24.04).
Key takeaways
-
Always install from Docker’s official repository, not Ubuntu’s: that’s how you get the most recent version and the Compose v2 plugin bundled in.
-
On Ubuntu 24.04 (Noble Numbat) the
noblecodename is read from/etc/os-release; the script splices it into the repository line automatically. -
The GPG key goes in
/etc/apt/keyrings/docker.ascand is referenced withsigned-by=insources.list.d. It’s the only method accepted since 22.04 and mandatory on 24.04. -
The daemon is managed with
systemctl; enabling it at boot saves you from starting it manually after every reboot.
Pre-installation steps
Update your system and make sure ca-certificates and curl are installed (they usually are):
sudo apt update
sudo apt install -y ca-certificates curl
If you’re coming from older installs via Ubuntu’s packages or snaps, remove them first to avoid conflicts with docker-ce:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
sudo apt remove -y "$pkg" 2>/dev/null || true
done
Add the official Docker repository
Create the keyrings directory and download Docker’s GPG key:
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
Add the repository, referencing the key by path with signed-by=. The Ubuntu codename is read from /etc/os-release; on 24.04 it returns noble:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable"
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
Ubuntu 24.04 LTS (Noble Numbat) logo, the reference operating system for this Docker installation
Ubuntu 24.04 LTS (Noble Numbat) logo, the reference operating system for this Docker installation
Install the Docker engine
Install the engine plus the usual plugins (Buildx and Compose v2 ship as docker subcommands):
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
After install, docker compose (no hyphen) works out of the box. The old standalone docker-compose binary is deprecated.
Configure the Docker daemon
The Docker daemon (dockerd) manages containers, images, networks, and volumes. Its configuration lives in /etc/docker/daemon.json:
sudo nano /etc/docker/daemon.json
Common options:
-
"log-driver": change the logging engine (defaults tojson-file; production setups often move tojournaldorlocal). -
"default-address-pools": customise IP ranges for container networks when they clash with the LAN. -
"data-root": move Docker’s data directory to another partition (useful when/var/lib/dockergrows).
After editing the file, reload the daemon:
sudo systemctl restart docker
Verify the installation
Check the installed versions:
docker --version
docker compose version
Verify the daemon is active and configured to start with the system:
sudo systemctl status docker
The output should show active (running). If it doesn’t start automatically, enable it:
sudo systemctl enable docker
A quick smoke test:
sudo docker run --rm hello-world
Docker logo, container engine that isolates applications from the runtime environment
Docker logo, container engine that isolates applications from the runtime environment
With Docker installed, the natural next steps are to orchestrate multi-container applications with Docker Compose (already bundled as docker compose), or set up Traefik as a reverse proxy to expose services on the internet. To run local LLMs on the same host, the Ollama guide covers the model catalogue and OpenAI-compatible API.
Frequently asked questions
Do I need Docker Desktop on Ubuntu?
No. Docker Desktop exists for macOS and Windows, where a virtualisation layer is required. On Ubuntu, the docker-ce engine installs directly from the official apt repository and runs natively, with nothing in between.
Why does apt-key add fail on Ubuntu 24.04?
Because the subcommand is retired: Debian and Ubuntu dropped the single keyring shared by every repository. Each third-party repository must now reference its own key with signed-by= pointing at a file under /etc/apt/keyrings, which is exactly the flow this guide follows.
Do I need to reboot after installing Docker?
No. Running sudo systemctl restart docker reloads the daemon’s configuration, and sudo systemctl enable docker makes it start on the next boot on its own. The install itself does not require a system reboot.
Conclusion
Installing Docker from the official repository on Ubuntu 24.04 LTS leaves you with the latest stable release, Compose v2 already bundled in, and the daemon ready under systemd. The apt-key flow is retired on 24.04. The signed-by= method pointing at /etc/apt/keyrings/docker.asc is the only one that survives a clean install.
This article is also available in Spanish: Cómo instalar Docker en Ubuntu 24.04.