How to Install and Use Docker Engine on Ubuntu 26.04 LTS

Install Docker Engine on Ubuntu 26.04 LTS from the official repo: set up the keyring, install Buildx and the Compose plugin, run Docker without sudo, uninstall.

Docker is a containerization platform that uses OS-level virtualization to run applications in isolated containers. Each container bundles its own software, libraries, and config and can talk to other containers over well-defined interfaces. Docker lets you build and run the same stack on your laptop, CI, and production.

In this guide we walk through installing Docker Engine on Ubuntu 26.04 LTS (Resolute Raccoon): from the official Docker repository, from a .deb package, or via the convenience script. We also cover running docker without sudo and removing Docker when it’s no longer needed.

Prerequisites

  • Ubuntu 26.04 LTS (Resolute) server or desktop with sudo access. The same steps work on Ubuntu 24.04 (Noble) and 22.04 (Jammy), since the repository suite is read from /etc/os-release.
  • A 64-bit system: Docker publishes packages for amd64, arm64, armhf, s390x, and ppc64el.
  • Internet access to download packages and images.

Update system packages

Update the package index and upgrade installed packages:

sudo apt update
sudo apt upgrade -y

Uninstall conflicting packages

Ubuntu ships its own Docker-related packages (docker.io, docker-compose, docker-compose-v2, podman-docker, and others) that conflict with Docker’s official packages. Remove any that are installed:

sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)

It’s OK if apt reports that none of these packages are installed. Images, containers, and volumes in /var/lib/docker/ are not removed.

Installing Docker

You can install Docker Engine in different ways, depending on your needs:

  • Set up Docker’s apt repository and install with apt (recommended)
  • Download the .deb packages and install them manually
  • Use Docker’s convenience script (dev and test machines only)

Install Docker Engine using the apt repository

On a new host you need to set up the Docker repository once. Afterwards, you install and update Docker with apt like any other package.

Install the prerequisites and add Docker’s official GPG key:

sudo apt install -y ca-certificates curl
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 as a deb822 .sources file. The suite (resolute on 26.04) and architecture are filled in automatically:

sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

Older guides (including the 22.04 version of this post) used a one-line docker.list file and gpg --dearmor. That still works, but the .sources format is what Docker documents today and the default style on modern Ubuntu. Never use apt-key add — it has been removed from APT.

Install Docker Engine

Update the package index and install Docker Engine, the CLI, containerd, and the Buildx and Compose plugins:

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Optional: install a specific version

To pin a particular Docker version, list the versions available in the repository:

apt list --all-versions docker-ce

Pick a version string from the output (it has the form 5:<version>-1~ubuntu.26.04~resolute) and install it:

VERSION_STRING=<version string from the list>
sudo apt install -y docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin

Install Docker Engine from a package

If you cannot use Docker’s repository, you can download the .deb files and install them manually. You need to download new files each time you want to upgrade Docker.

Browse download.docker.com/linux/ubuntu/dists/, pick resolute, then pool/stable/ and your architecture. Download the containerd.io, docker-ce, docker-ce-cli, docker-buildx-plugin, and docker-compose-plugin .deb files, then install them together (adjust the paths):

sudo dpkg -i ./containerd.io_*.deb \
  ./docker-ce_*.deb \
  ./docker-ce-cli_*.deb \
  ./docker-buildx-plugin_*.deb \
  ./docker-compose-plugin_*.deb

The Docker daemon starts automatically. Fix any missing dependencies with sudo apt install -f if needed.

Install using the convenience script

For a quick install on a dev or CI machine, use Docker’s script. Review it before running, and don’t use it on production hosts:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

This installs the latest stable Docker Engine. Add your user to the docker group if you want to run docker without sudo (see below).

Verify installation

Docker starts as a systemd service after install. Check its status:

sudo systemctl status docker

Active: active (running) means the daemon is up. If it isn’t running, start and enable it:

sudo systemctl enable --now docker

Test the installation with the hello-world image:

sudo docker run hello-world

Docker pulls the image and runs it; the output includes:

Hello from Docker!
This message shows that your installation appears to be working correctly.

Check the installed versions of the engine and the Compose plugin:

docker version
docker compose version

Run Docker without sudo

The docker group is created during install but contains no users, so only root can talk to the daemon. Running docker ps as a normal user fails with an error like:

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

To run docker without sudo, add your user to the docker group:

sudo usermod -aG docker $USER

Apply the new group: log out and back in, or run:

newgrp docker

Confirm docker is in your groups:

id -nG

Then run a container without sudo:

docker run --rm -it alpine:3 /bin/sh

Security note: members of the docker group effectively have root on the host. If that’s a concern, look at Docker’s rootless mode instead.

Firewall caveat (ufw)

If you manage the firewall with ufw, be aware that ports you publish with -p bypass ufw rules, because Docker writes its own iptables rules. Bind ports to 127.0.0.1 (for example -p 127.0.0.1:8080:80) when a service should not be reachable from outside, or put a reverse proxy in front. See Docker’s packet filtering and firewalls docs for details.

Uninstalling Docker

To remove Docker Engine, the CLI, containerd, and the plugins:

sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

Images, containers, volumes, and config under /var/lib/docker and /var/lib/containerd are not removed by purge. To delete all Docker data:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Remove the repository and key as well:

sudo rm /etc/apt/sources.list.d/docker.sources
sudo rm /etc/apt/keyrings/docker.asc

Conclusion

You installed Docker Engine on Ubuntu 26.04 LTS using the official Docker repository (recommended), .deb packages, or the convenience script. You verified the daemon with systemctl status docker and docker run hello-world, added your user to the docker group to run Docker without sudo, and saw how to uninstall Docker and clean up its data. The Docker Compose plugin (docker compose) comes with the repository install; for Compose examples see Getting started with Docker Compose.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy