Install Docker on Ubuntu 26.04: Official Repository Setup Guide
Docker is an open-source container platform that packages application code together with its dependencies and runtime into portable containers. Those containers run identically across developer laptops, test environments, and production servers, removing the “it works on my machine” problem from deployment workflows.
Ubuntu ships a docker.io package in its default repositories, but it is typically several major versions behind. Installing from Docker’s official repository gives you the latest stable release and timely security patches.
This guide covers how to install Docker on Ubuntu 26.04 LTS (codename: resolute) from the official Docker repository.
<strong>Prerequisite: </strong>You need a 64-bit Ubuntu 26.04 system, sudo access, and an internet connection.
Remove conflicting packages first. Packages like docker.io and podman-docker from the Ubuntu repositories conflict with the official Docker packages and must be removed before continuing:
bash
sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc<br>Install the required dependencies:
bash
sudo apt update<br>sudo apt install ca-certificates curl<br>Import Docker's GPG signing key. This key lets apt verify the authenticity of Docker packages before installing them:
bash
sudo install -m 0755 -d /etc/apt/keyrings<br>sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<br>sudo chmod a+r /etc/apt/keyrings/docker.asc<br>The install -m 0755 -d command creates the /etc/apt/keyrings directory with exact permissions in a single step, which is cleaner than mkdir followed by chmod. The chmod a+r call makes the key file readable by all users, including the _apt system user that apt uses internally to verify packages during download.
Add the Docker repository using the DEB822 .sources format — a structured multi-line format that replaces the older single-line .list format on modern Ubuntu systems:
bash
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF<br>Types: deb<br>URIs: https://download.docker.com/linux/ubuntu<br>Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")<br>Components: stable<br>Architectures: $(dpkg --print-architecture)<br>Signed-By: /etc/apt/keyrings/docker.asc<br>EOF<br>The ${UBUNTU_CODENAME:-$VERSION_CODENAME} expression reads the release codename from /etc/os-release and falls back to VERSION_CODENAME if the primary variable is not set. On Ubuntu 26.04, this returns resolute. Install Docker Engine:
bash
sudo apt update<br>sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin<br>All five packages are needed for a complete install: docker-ce is the daemon, docker-ce-cli is the command-line client, containerd.io is the container runtime, docker-buildx-plugin enables multi-platform image builds, and docker-compose-plugin provides the docker compose subcommand.
To install a specific Docker version, list what is available and copy a version string:
bash
apt list --all-versions docker-ce 2>/dev/null | awk 'NR>1 {print $2}'<br>Pin docker-ce and docker-ce-cli to the same version string. The daemon and CLI must match because each version pair defines a specific API contract: bash
DOCKER_VERSION="5:29.4.0-1~ubuntu.26.04~resolute"<br>sudo apt install docker-ce=$DOCKER_VERSION docker-ce-cli=$DOCKER_VERSION containerd.io docker-buildx-plugin docker-compose-plugin<br>Verify the Installation and Run Docker Without sudo<br>The Docker service starts automatically after installation on most Ubuntu systems. If it does not:
bash
sudo systemctl start docker<br>sudo systemctl status docker<br>Confirm the client and daemon are both responding:
bash
sudo docker version<br>Run the test container to verify the full pipeline end to end:
bash
sudo docker run hello-world<br>Docker pulls the hello-world image from Docker Hub, runs it in an isolated container, prints a confirmation message, and exits. The container stops immediately because it has no long-running process — this is the expected outcome.
Run Docker without sudo. By default, the Docker socket is accessible only to root. Add your user to the docker group to remove this requirement:
bash
sudo usermod -aG docker $USER<br>Apply the group change in the current session without logging out:
bash
newgrp docker<br>Or log out and log back in to apply it to all new sessions. Verify: docker run hello-world.
Security note: Members of the docker group can mount any host path into a container, giving them an effective path to root-level access on the host. Only add trusted users to this group.
Update, Pin, and Uninstall Docker
Update Docker using the standard apt commands:
bash
sudo apt update && sudo apt upgrade<br>Prevent automatic upgrades by marking Docker as held:
bash
sudo apt-mark hold docker-ce<br>Uninstall Docker cleanly. Remove all running containers and stored data before removing the packages — skipping this step leaves image layers, volumes, and networks on disk after the packages are gone:
bash
docker container stop $(docker container ls -aq)<br>docker system prune -a --volumes -f<br>Remove the packages and the data directories:
bash
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras<br>sudo apt autoremove<br>sudo rm -rf /var/lib/{docker,containerd}<br>Docker is now installed on Ubuntu 26.04 from the official repository. For next steps, configure log drivers, set up rootless mode for improved security isolation, or move to a multi-node setup with Kubernetes and kubeadm. Leave a comment below if you run into any issues. Asterisk is the most widely deployed open-source PBX (Private Branch Exchange) platform in the world. It…
Ghost is an open-source publishing platform built on Node.js. It is designed for bloggers, journalists, and…
Mattermost is an open-source, self-hosted team messaging platform and a direct alternative to Slack. It is…
Ruby is a dynamic, open-source programming language known for its clean, readable syntax. It powers the…
PyCharm is a full-featured Python IDE developed by JetBrains. It includes built-in debugging, embedded Git control,…
PHP 8.5 is included in Ubuntu 26.04's default repositories and is the recommended version for…