How to install Docker on Ubuntu 24.04 starts with a clean LTS install, a few apt commands, and a pinch of security hardening. By the end of this article you will have Docker Engine, containerd, BuildKit, and the Compose V2 plugin running as a first‑class citizen on Ubuntu 24.04 (codenamed Noble Numbat). The steps are reproducible on laptops, Raspberry Pi 4, or cloud VMs, and they respect Ubuntu’s new /etc/apt/keyrings/ layout.
Overview & Quick Answer – how to install docker on ubuntu 24.04
What you’ll get by the end
- Docker Engine 23.x, containerd 1.7, BuildKit, and Compose V2 installed from Docker’s official APT repo.
- A non‑root user capable of running
dockercommands (optional rootless mode). - Verification steps using the
hello‑worldimage and a basicdocker composefile.
One‑liner
Run a single apt line to pull docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, and docker-compose-plugin – then test with sudo docker run hello-world.
Why Docker on Ubuntu 24.04 Matters in 2026
Modern container workloads
Ubuntu 24.04 ships with cgroups v2 and a unified systemd hierarchy, which Docker has fully embraced. This alignment reduces kernel‑level overhead, yielding a typical CPU footprint of 2‑4 % on idle and 0.2 GB RAM for the daemon. The same stack powers the majority of CI/CD pipelines, edge AI services, and micro‑service architectures in 2026.
Security updates & compliance
Docker’s official repository pushes security patches within 48 hours of CVE disclosure. Ubuntu’s LTS guarantee (2024‑2029) means you stay compliant without hunting third‑party repos. The daemon respects AppArmor profiles out‑of‑the‑box, and you can enable user namespaces for added isolation.
Compatibility with Kubernetes and CI/CD
Kubernetes 1.30, released earlier this year, still uses the Docker Engine’s containerd shim for legacy workloads. Installing Docker from the upstream repo guarantees that kubectl and helm find the expected socket at /var/run/docker.sock. Most CI runners (GitHub Actions, GitLab CI) also default to Docker CE for build‑and‑test stages.
Prerequisites & System Requirements – how to install docker on ubuntu 24.04
Supported Ubuntu 24.04 LTS releases
- Desktop edition (GNOME 44) – minimum 4 GB RAM, 2 CPU cores.
- Server edition – 2 CPU cores, 2 GB RAM (Docker daemon itself uses ≈150 MB).
Hardware & kernel version
Any kernel ≥ 6.5 (the default in Noble) works. For ARM64 boards (e.g., Raspberry Pi 4 64‑bit) replace amd64 with arm64 in the repository line.
Network & firewall settings
Docker creates a docker0 bridge (default subnet 172.17.0.0/16). If you run UFW, allow traffic to this bridge:
sudo ufw allow in on docker0
sudo ufw reload
Choosing the Right Docker Installation Method
Official Docker CE repo vs. Ubuntu repos
The docker.io package in Ubuntu’s archive lags behind upstream by several months and bundles an older containerd. The official CE repo delivers the latest Engine, BuildKit, and Compose V2 together, keeping you on the same release cadence as Docker Hub.
Docker Desktop for Linux – pros and cons
Docker Desktop runs a lightweight Alpine VM via QEMU/KVM. It adds a system‑tray UI, integrated Kubernetes, and extensions like Docker Scout. The trade‑off is an extra 1–2 GB RAM consumption and a second network namespace. For headless servers, the overhead is unnecessary.
Rootless Docker vs. privileged mode
Rootless mode launches the daemon under an unprivileged user namespace, eliminating the need for the docker group. Performance impact is modest: docker run latency rises ~5 ms, and CPU usage stays under 5 % for typical workloads. Privileged mode (daemon as root) is still the default for single‑user desktops.
Step‑by‑Step: Installing Docker Engine from Official Repo
Uninstall old docker.io packages
sudo apt purge -y docker.io docker-doc docker-compose-plugin
sudo apt autoremove -y
Set up GPG key and repository
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install docker‑ce, docker‑ce‑cli, containerd.io
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin
Verify installation with hello‑world
sudo systemctl enable --now docker
sudo docker run --rm hello-world
The output should begin with “Hello from Docker!” confirming that the daemon, CLI, and networking are healthy.
Enabling and Configuring Docker Compose V2
Installing compose plugin
The docker-compose-plugin package ships the V2 binary as docker compose. No separate binary is needed.
Using docker compose up
cat > docker-compose.yml <<'EOF'
version: "3.9"
services:
web:
image: nginx:alpine
ports:
- "8080:80"
EOF
docker compose up -d
Compose file best practices
- Pin image tags (e.g.,
nginx:1.25-alpine) to avoid accidental upgrades. - Define resource limits with
deploy.resources.limitsfor production. - Store secrets in Docker Swarm/Kubernetes or use
docker secretinstead of env vars.
Switching between compose v1 & v2
If you still need the legacy docker‑compose binary, install it via pip3 install docker-compose. The V2 plugin will take precedence when both are present.
Rootless Docker vs. Docker Group: Security Trade‑offs
What rootless mode does
Rootless Docker runs the daemon in a user namespace, mapping the host UID range to a high, unprivileged range (65536‑100000). This prevents a compromised container from gaining root on the host.
Adding user to docker group – risks
Members of the docker group can bind‑mount any host directory into a container, effectively granting root. On multi‑tenant servers, that is a serious privilege escalation vector.
Configuring rootless Docker
sudo apt install -y docker-ce-rootless-extras
dockerd-rootless-setuptool.sh install
After installation, log out and back in; the daemon will start automatically under your user.
Performance impact
Benchmarks on a 4‑core, 8 GB VM show a 3‑5 % increase in container start‑up time versus privileged mode. For most development workloads the trade‑off is acceptable, especially when security policies demand it.
Common Pitfalls & Troubleshooting Tips
Conflicting packages & apt errors
If you see “Unable to locate package docker‑ce”, double‑check that /etc/apt/sources.list.d/docker.list references the correct VERSION_CODENAME (noble). Run sudo apt update again.
Permissions & socket access
Running docker ps without sudo after adding yourself to the docker group requires a new login session. The shortcut newgrp docker refreshes group membership in the current shell.
SELinux/AppArmor issues
Ubuntu ships with AppArmor profiles for Docker. If a container fails to start, inspect journalctl -u docker for “apparmor” denials and adjust the profile or disable it with sudo aa-disable /etc/apparmor.d/docker.
Network bridge problems
When docker0 collides with an existing subnet, edit /etc/docker/daemon.json:
{
"bip": "172.31.0.1/16"
}
Who Should Use This Guide? (Persona Table)
| Target Persona | Recommended Option | Key Reason & Real‑World Benefit |
|---|---|---|
| Developer on a personal laptop | Docker Desktop (GUI) + rootless mode | Integrated UI, easy Kubernetes toggle, modest RAM overhead (<2 GB) suitable for day‑to‑day coding. |
| DevOps on a production server | Docker Engine from official repo (privileged) | Lowest resource footprint, predictable startup, seamless integration with CI/CD pipelines. |
| Sysadmin managing shared hosts | Rootless Docker + sudo‑only access | Eliminates the “docker” group privilege escalation risk while keeping performance acceptable. |
| Cloud‑native architect | Docker Engine + Compose V2 + Kubernetes‑ready configuration | Provides consistent runtime across on‑prem, edge, and cloud, ready for migration to K8s. |
Final Verdict & Next Steps – how to install docker on ubuntu 24.04
Summary of benefits
Installing Docker from the official repository gives you the freshest Engine, a lean containerd runtime, and the Compose V2 plugin in a single transaction. The daemon’s idle RAM stays under 200 MB, and CPU load is negligible, making it suitable for everything from a 2 GB VM to a 32‑core cloud instance.
Recommended next learning steps
- Explore multi‑stage builds with
docker buildxto shrink image size. - Secure your daemon: enable user namespaces and configure
/etc/docker/daemon.jsonlog rotation. - Deploy a real workload, e.g., Nextcloud All‑in‑One (
docker run -d -p 8443:8443 ...), to see volume persistence in action. - Integrate Docker with GitHub Actions or GitLab CI for automated testing.
Resources & community links
- Official Docker GPG key
- Docker Engine installation guide (Ubuntu)
- Compose V2 GitHub repository
- Docker Hub – public image registry
Following this step‑by‑step tutorial ensures you have a production‑ready container runtime on Ubuntu 24.04, with the flexibility to scale from a single developer laptop to a multi‑node Kubernetes cluster.