Updated: 2026-07-17

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 Docker Engine (the container runtime: the dockerd daemon, the command-line client, and the Compose and Buildx plugins, without Docker Desktop’s graphical interface) on Ubuntu 24.04 LTS from the official repository, using the modern flow with a GPG key (a cryptographic signature that certifies the packages come from Docker) 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 noble codename is read from /etc/os-release; the script splices it into the repository line automatically.
  • The GPG key goes in /etc/apt/keyrings/docker.asc and is referenced with signed-by= in sources.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.
  • After installing, add your user to the docker group so you do not need to prefix every command with sudo (with the security trade-off that implies).

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 docker-ce package (Docker Engine, Community edition) 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 to json-file; production setups often move to journald or local).
  • "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/docker grows).

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

Add your user to the docker group

By default only root and members of the docker group (a system group the install creates automatically that grants access to the /var/run/docker.sock socket without sudo) can talk to the daemon. Add your user and apply the change in the current session:

sudo usermod -aG docker $USER
newgrp docker

Run docker run hello-world again, this time without sudo, to confirm the change took effect. Belonging to the docker group is equivalent to root access on the host, so do not add users you do not trust.

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 (a reverse proxy that routes incoming traffic to the right container based on the domain) to expose services on the internet. To run large language models on the same host, the Ollama guide (a tool that downloads and serves LLMs locally with an OpenAI-compatible API) covers the available model catalogue. This guide is also available in Spanish.

Frequently asked questions

Do I need to remove Docker Desktop before installing Docker Engine?

Yes, if you run Ubuntu as a desktop with Docker Desktop installed, remove it first (sudo apt remove docker-desktop) to avoid two daemons competing for the same socket. On a headless server, Docker Desktop is never present and this step does not apply.

Why does the docker command fail with “permission denied” without sudo?

Because your user does not belong to the docker group yet, or the session has not reloaded group membership since you were added. Run sudo usermod -aG docker $USER and then newgrp docker (or log out and back in).

What is the difference between Docker Engine and Docker Desktop?

Docker Engine is the container runtime itself (the dockerd daemon, the command-line client, and the container runtime), installed directly on Linux via the docker-ce package. Docker Desktop adds a graphical interface and a lightweight virtual machine to run it on macOS or Windows; on an Ubuntu server it is not needed.

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.

Sources: [1] Install Docker Engine on Ubuntu (Docker Docs)[2], [2] Linux post-installation steps for Docker Engine (Docker Docs)[3], [3] Ubuntu Server Documentation[4], [4] docker-ce release notes on GitHub[5].

Sources

  1. Docker
  2. Install Docker Engine on Ubuntu (Docker Docs)
  3. Linux post-installation steps for Docker Engine (Docker Docs)
  4. Ubuntu Server Documentation
  5. docker-ce release notes on GitHub

Route: Self-hosting with Docker: from zero to production