How to Install Docker on Ubuntu 24.04
Actualizado: 2026-05-18
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 curlIf 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
doneAdd 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.ascAdd 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 updateUbuntu 24.04 LTS (Noble Numbat) logo, the reference operating system for this Docker installation
Install Docker CE
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-pluginAfter 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.jsonCommon 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 dockerVerify the installation
Check the installed versions:
docker --version
docker compose versionVerify the daemon is active and configured to start with the system:
sudo systemctl status dockerThe output should show active (running). If it doesn’t start automatically, enable it:
sudo systemctl enable dockerA quick smoke test:
sudo docker run --rm hello-worldDocker 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.
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.