Official Apt Repository

Installing Docker Engine from Docker's Official Apt Repository

Docker 514 supports Ubuntu 26.04 225 , 24.04 and 22.04. First remove conflicting archive packages (docker.io, docker-compose, docker-compose-v2, docker-doc, docker-buildx, podman-docker, containerd 234,762 , runc 13,463 ) with sudo apt remove $(dpkg --get-selections <packages> | cut -f1). Then add the key and repository, and install:

Adding Docker's apt repository and installing Docker Engine (from docs.docker.com)Shell
sudo apt update
sudo apt install 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
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
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin \
  docker-compose-plugin

The repository uses apt's deb822 .sources format, and Signed-By trusts Docker's key for this repository only. On this machine the result looks like this (apt-get -s only simulates):

Checking what the installation left behindShell
apt-cache policy docker-ce | head -3
apt-get -s install docker-ce docker-ce-cli containerd.io docker-buildx-plugin \
  docker-compose-plugin | tail -1
Output
docker-ce:
  Installed: 5:29.8.1-1~ubuntu.26.04~resolute
  Candidate: 5:29.8.1-1~ubuntu.26.04~resolute
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

The packages enable the docker and containerd services and create a docker group. Note that ports published with -p bypass ufw and firewalld 292,900 , because Docker writes its own iptables 40,292 rules; filter them in DOCKER-USER.