How to Install Docker on Ubuntu 26.04 and 24.04 (Docker Engine 29)

Based on the official docs for Docker Engine 29.10.1 on Ubuntu 26.04, 24.04 and 22.04 Hardware test not run How guides are made and checked

Typed sudo apt install docker.io and ended up with an older Docker than the docs you’re reading? Or followed an old guide and hit apt-key warnings? Ubuntu’s own package works, but it trails Docker’s releases, and the install steps changed a fair bit since Ubuntu 20.04.

Below are the current steps from Docker’s docs to install Docker Engine 29 from Docker’s own apt repository on Ubuntu 26.04, 24.04 or 22.04, then run, inspect and clean up your first containers. I run Docker at home, and this is the install method I’d pick for any server.

Watch the video on YouTube

What is Docker?

Docker packages an application and everything it needs into a container, so it runs the same way on your laptop, a home lab box or a cloud server.

Containers aren’t virtual machines. They share the host’s kernel and get their own isolated processes, memory limits and network, so they start in seconds and use far less disk and RAM. Each container usually does one job, such as a MySQL database or a Node.js app, and you connect several together to build a full stack. Images are built in layers, so containers that share a base image share those files on disk.

Requirements

  • A 64-bit server running Ubuntu 26.04 LTS (Resolute), 24.04 LTS (Noble), 22.04 LTS (Jammy) or 26.10. These are the releases Docker supports today. Ubuntu 18.04 and 20.04 are no longer supported.
  • A user with sudo rights.
  • x86_64 (amd64), arm64, armhf, s390x or ppc64le hardware.

Derivatives such as Linux Mint aren’t officially supported, though the steps may work. If you’re on Alpine instead, see setting up Docker on Alpine Linux.

Remove old or conflicting packages

Ubuntu’s docker.io, docker-compose, podman-docker and its own containerd and runc packages clash with Docker’s packages. Remove any that are installed:

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

If none are installed, apt says so and you can move on. Your images and volumes in /var/lib/docker aren’t removed by this.

Add Docker’s apt repository

Docker now stores its signing key in /etc/apt/keyrings and uses the newer deb822 .sources format. The old apt-key add and add-apt-repository commands are deprecated, so skip them if you see them in older guides.

First, add Docker’s GPG key:

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

Next, add the repository. This picks up your Ubuntu codename and CPU architecture 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

sudo apt update

The last apt update should list download.docker.com without errors.

Install Docker Engine

Install the engine, the CLI, containerd and the Buildx and Compose plugins:

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

Need a specific version, for example to match another server? List what’s available and pin it:

apt list --all-versions docker-ce
VERSION_STRING=5:29.10.1-1~ubuntu.24.04~noble
sudo apt install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin

Use a version string from your own list, since it includes the Ubuntu release.

Check that Docker is running

On Ubuntu, Docker starts straight after the install and on every boot. Check the service:

sudo systemctl status docker

You should see Active: active (running). If it isn’t, start it with sudo systemctl start docker. Then run the test image:

sudo docker run hello-world

It downloads a tiny image, prints “Hello from Docker!” and exits. That means the engine, the registry connection and container start all work.

docker version shows the client and server versions, and docker info shows the storage driver, number of containers and images, and the Docker root directory.

Run Docker without sudo (optional)

By default, Docker commands need sudo. To run them as your own user, add yourself to the docker group:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

On Ubuntu the group usually exists already, so groupadd may just say so. Log out and back in so every session picks up the change.

Be careful with this one. Docker’s docs warn that the docker group grants root-level privileges, because anyone in it can start a container that mounts the host’s filesystem. On a shared server I’d stick with sudo, or look at rootless mode.

How to use Docker

The basic syntax is:

docker [OPTIONS] COMMAND [ARGUMENTS]

Run docker on its own for the full list of commands, or docker COMMAND --help for details on one of them. The commands below are the ones you’ll use most.

Pull a Docker image from Docker Hub

An image is the read-only template a container starts from. Most public images live on Docker Hub. For example, pull the official Nginx image:

docker pull nginx

Then list the images on your server:

docker images

You should see nginx with the latest tag. Pin a tag such as nginx:1.29 for anything you care about, so an update doesn’t surprise you.

Run a Docker container

There are two common ways to run a container.

Run a Docker container in interactive mode

-it gives you a shell inside a new container, and --rm deletes it when you exit:

docker run -it --rm nginx /bin/bash

Your prompt changes to something like root@2cc89e08ffb2:/#. Run commands as you would on any Linux box, then type exit to leave.

Run a Docker container in detached mode

-d runs the container in the background. This starts Nginx and publishes container port 80 on host port 8080:

docker run -d --name web -p 8080:80 nginx

List running containers:

docker ps

You’ll see web with 0.0.0.0:8080->80/tcp under PORTS, and http://<server-ip>:8080 shows the Nginx welcome page. To open a shell in the running container, use:

docker exec -it web /bin/bash

Run a Docker container with a volume

A bind mount shares a folder on the host with the container, so the data survives when the container is removed. Create a folder and mount it as Nginx’s web root:

mkdir -p ~/site
echo "Hello from the host" > ~/site/index.html
docker run -d --name web2 -p 8081:80 -v ~/site:/usr/share/nginx/html:ro nginx

Browse to port 8081 and you’ll see your page. The :ro makes the mount read-only inside the container, which is a good habit for content the container only needs to read. Need the data on a NAS instead? See mounting an NFS share into a container.

Copy files to and from a container

docker cp copies files in either direction:

docker cp ./nginx.conf web:/tmp/
docker cp web:/etc/nginx/nginx.conf ./nginx.conf.backup

Start, stop and pause a container

docker stop web
docker start web
docker pause web
docker unpause web

To stop every running container at once:

docker stop $(docker ps -q)

Remove a Docker container

Stop the container first, then remove it:

docker stop web
docker rm web

To remove every stopped container in one go:

docker container prune

Remove Docker images

List your images, then remove one by name or ID:

docker images
docker rmi nginx

If a container still uses the image, Docker refuses with conflict: unable to delete ... image is being used by running container. Stop and remove that container first. To clear out every image that no container uses:

docker image prune -a

It asks you to confirm and then shows how much space it reclaimed.

Keep Docker updated

Because Docker comes from its own repository, normal updates pick up new releases:

sudo apt update && sudo apt upgrade

That matters right now. Docker Engine 29.10.1 (24 November 2026) fixes CVE-2026-135124, where a read-only bind mount could be made writable during docker cp, and CVE-2026-135844, unbounded reads when parsing user and group mapping files. Release 29.9.3 fixed four more, including two in Swarm. Check your version with docker version.

If you’re upgrading from before 29.10.0 and run a local registry, read the release notes first: loopback addresses like 127.0.0.1 are no longer treated as insecure registries automatically once you set insecure-registries yourself.

Troubleshooting

Published ports bypass UFW. Docker writes its own iptables rules, so a port published with -p is reachable even if UFW says it’s blocked. Publish to localhost only (-p 127.0.0.1:8080:80) for anything that sits behind a reverse proxy, or add your rules to the DOCKER-USER chain. This one catches a lot of people!

permission denied while trying to connect to the Docker daemon socket. Your user isn’t in the docker group yet, or your session predates the change. Use sudo, or follow the non-root steps above and log in again.

Cannot connect to the Docker daemon. The service isn’t running. Start it with sudo systemctl start docker and check journalctl -u docker for the reason.

Package ‘docker-ce’ has no installation candidate. The repository wasn’t added correctly or isn’t supported for your release. Check /etc/apt/sources.list.d/docker.sources and run sudo apt update again.

Images still filling the root disk after moving data-root. Docker 29 uses the containerd image store by default on fresh installs, and those images live under /var/lib/containerd. Changing data-root in daemon.json alone doesn’t move them; see Docker’s containerd image store docs.

Where to go next

Once Docker is running, writing your own Dockerfile is the natural next step. For a bigger real-world stack run with Compose, try Greenbone with Docker Compose to scan your own servers for vulnerabilities.

Sources

Updated 30 November 2026: rewritten for Docker Engine 29 on Ubuntu 26.04, 24.04 and 22.04 with Docker’s current apt repository steps, non-root setup, the UFW port trap, troubleshooting and the latest security fixes.