Custom Software Development

How to Install Docker and Docker Compose on Ubuntu 26.04 LTS (Resolute Raccoon) — Complete Guide

How to install Docker and Docker Compose on Ubuntu 26.04 Resolute Raccoon

Docker has become the industry standard for containerising applications — from local development environments to production deployments serving millions of users. Ubuntu 26.04 LTS (Resolute Raccoon), released in April 2026, ships with kernel 7.0 and cgroup v2 by default, making it an excellent host for Docker workloads.

This guide covers the complete installation of Docker Engine 29.4.0 and Docker Compose v2 (v5.1.2) on Ubuntu 26.04 from Docker’s official repository — the recommended method that gives you the latest stable releases and security updates. By the end, you will have a fully working Docker environment, Docker Compose, and a test container running to confirm everything works.

✅ What this guide covers:

  • Remove conflicting packages
  • Install Docker Engine from Docker’s official APT repository
  • Install Docker Compose (bundled as docker-compose-plugin)
  • Post-installation: run Docker without sudo
  • Enable Docker on startup
  • Verify installation with hello-world and a real Nginx container
  • Practical docker-compose.yml example
  • Quick reference for essential Docker commands

Prerequisites

Before you begin, ensure you have:

  • A running Ubuntu 26.04 LTS system (fresh install recommended)
  • A user account with sudo privileges
  • Internet access for downloading packages
  • Minimum 2 GB RAM and 10 GB disk space

All commands in this guide are run as a non-root user with sudo. Do not run as root directly.

Step 1 — Remove Conflicting Packages

Ubuntu 26.04 may include older Docker packages from its own repositories (docker.io, docker-compose, containerd, runc). These conflict with Docker’s official packages. Remove them first:

$ for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt remove -y $pkg 2>/dev/null; done

If none of these are installed, apt will simply report that there is nothing to remove — that is fine. Your existing images, containers, volumes, and networks stored under /var/lib/docker/ are not automatically removed when you uninstall old packages.

Step 2 — Update the System

Always start with a full system update before installing new software:

$ sudo apt update && sudo apt upgrade -y

Step 3 — Install Required Dependencies

Install the packages Docker’s repository setup requires:

$ sudo apt install -y ca-certificates curl gnupg lsb-release apt-transport-https

These packages allow apt to use HTTPS repositories and verify GPG signatures.

Step 4 — Add Docker’s Official GPG Key

Create the keyrings directory and download Docker’s official GPG key:

$ 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

The -fsSL flags ensure the download fails silently if there are errors (showing only real errors) and follows redirects. The chmod a+r command makes the key readable by all users so apt can use it.

Step 5 — Add the Docker Repository

Add Docker’s official APT repository to your system’s sources list:

$ echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

This single command automatically detects your Ubuntu codename (resolute for Ubuntu 26.04) and architecture, then writes the correct repository entry. Verify it was written correctly:

$ cat /etc/apt/sources.list.d/docker.list

You should see output similar to:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu resolute stable

Step 6 — Install Docker Engine

Update the package index to include Docker’s repository, then install Docker Engine, the CLI, containerd, and the Compose and Buildx plugins:

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

Here’s what each package provides:

  • docker-ce — Docker Community Edition engine (the daemon)
  • docker-ce-cli — Docker command-line interface (docker command)
  • containerd.io — Container runtime that Docker uses under the hood
  • docker-buildx-plugin — Extended build capabilities, multi-platform builds
  • docker-compose-plugin — Docker Compose v2, integrated as docker compose

Step 7 — Start and Enable Docker

Start the Docker service and configure it to start automatically when the system boots:

$ sudo systemctl start docker
$ sudo systemctl enable docker

Confirm Docker is running:

$ sudo systemctl status docker

You should see ● docker.service – Docker Application Container Engine with status active (running).

Step 8 — Verify the Installation

Check the installed versions of Docker and Docker Compose:

$ docker --version
Docker version 29.4.0, build 7a8a07d
$ docker compose version
Docker Compose version v5.1.2

Run the official hello-world container to confirm Docker can pull images and run containers:

$ sudo docker run hello-world

Docker will download the hello-world image from Docker Hub and run it. You will see a confirmation message that Docker is working correctly.

Step 9 — Run Docker Without sudo

By default, the Docker daemon runs as root and only users in the docker group can communicate with it. Add your user to the docker group so you can run Docker commands without sudo:

$ sudo usermod -aG docker $USER

Apply the group change without logging out:

$ newgrp docker

Verify you can run Docker without sudo:

$ docker run hello-world
⚠️ Security Note: The docker group grants root-equivalent privileges. Only add trusted users to this group. In production environments, consider rootless Docker mode instead.

Step 10 — Configure Docker to Start on Boot

Docker should already be enabled from Step 7. Confirm it is set to start on boot:

$ sudo systemctl is-enabled docker

Output should be enabled. If containerd also needs to start automatically:

$ sudo systemctl enable containerd

Step 11 — Run a Real Container: Nginx Web Server

Test your Docker installation with a real-world example. Run an Nginx container, mapping port 8080 on your host to port 80 inside the container:

$ docker run -d --name my-nginx -p 8080:80 nginx:latest

Verify the container is running:

$ docker ps

You should see my-nginx listed with status Up. Access Nginx in your browser at http://localhost:8080 or via curl:

$ curl -I http://localhost:8080

Stop and remove the container when done:

$ docker stop my-nginx && docker rm my-nginx

Step 12 — Docker Compose: Multi-Container Example

Docker Compose is now bundled as docker compose (space, not hyphen). Create a practical WordPress + MariaDB stack to see Compose in action:

Create a project directory:

$ mkdir ~/wordpress-stack && cd ~/wordpress-stack

Create the docker-compose.yml file:

$ nano docker-compose.yml

Paste the following configuration:

version: '3.9'

services:
  db:
    image: mariadb:11.8
    container_name: wp-mariadb
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wpuser
      MYSQL_PASSWORD: wppassword
    volumes:
      - db_data:/var/lib/mysql

  wordpress:
    image: wordpress:latest
    container_name: wp-app
    restart: unless-stopped
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wpuser
      WORDPRESS_DB_PASSWORD: wppassword
      WORDPRESS_DB_NAME: wordpress
    volumes:
      - wp_data:/var/www/html
    depends_on:
      - db

volumes:
  db_data:
  wp_data:

Start all services in detached mode:

$ docker compose up -d

Check the status of all services:

$ docker compose ps

View logs from all containers:

$ docker compose logs -f

Stop all services (volumes are preserved):

$ docker compose down

Stop and remove everything including volumes:

$ docker compose down -v

Essential Docker Commands Reference

Here are the most commonly used Docker commands you will reach for daily:

Images

# List all local images
$ docker images

# Pull an image from Docker Hub
$ docker pull ubuntu:26.04

# Remove an image
$ docker rmi ubuntu:26.04

# Remove all unused images
$ docker image prune -a

Containers

# List running containers
$ docker ps

# List all containers (including stopped)
$ docker ps -a

# Start a container interactively
$ docker run -it ubuntu:26.04 /bin/bash

# Run a container in background (detached)
$ docker run -d --name myapp -p 3000:3000 myimage:latest

# Execute a command in a running container
$ docker exec -it myapp /bin/bash

# Stop a running container
$ docker stop myapp

# Remove a container
$ docker rm myapp

# View container logs
$ docker logs -f myapp

# Container stats (live resource usage)
$ docker stats

Volumes

# List volumes
$ docker volume ls

# Create a volume
$ docker volume create mydata

# Remove unused volumes
$ docker volume prune

Networks

# List networks
$ docker network ls

# Create a custom network
$ docker network create mynetwork

# Connect a container to a network
$ docker network connect mynetwork myapp

System Cleanup

# Remove all stopped containers, unused networks, dangling images
$ docker system prune

# Full cleanup including unused volumes (use with caution)
$ docker system prune -a --volumes

# Check disk usage
$ docker system df

Updating Docker

Since Docker is installed via APT from Docker’s official repository, updates are handled through the standard Ubuntu package manager:

$ sudo apt update && sudo apt upgrade -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

This ensures you always get the latest stable release with security patches.

Uninstalling Docker (If Needed)

To completely remove Docker from your system:

# Remove Docker packages
$ sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Remove Docker data (images, containers, volumes — irreversible)
$ sudo rm -rf /var/lib/docker /var/lib/containerd

# Remove the Docker repository and GPG key
$ sudo rm /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.asc

Troubleshooting Common Issues

Permission Denied Running Docker

If you see permission denied while trying to connect to the Docker daemon socket, you have not added your user to the docker group or have not applied the change yet:

$ sudo usermod -aG docker $USER && newgrp docker

Docker Daemon Not Starting

# Check the Docker service journal for errors
$ sudo journalctl -xeu docker.service

# Restart Docker
$ sudo systemctl restart docker

Cannot Connect to Docker Hub

If docker pull fails with network errors, check that DNS resolution works and that outbound HTTPS (port 443) is not blocked by a firewall:

$ curl -I https://registry-1.docker.io/v2/

Old docker-compose Command (v1) Not Found

Docker Compose v2 is installed as a Docker CLI plugin and is invoked as docker compose (with a space). If scripts expect docker-compose (with a hyphen), create a compatibility alias:

$ echo 'alias docker-compose="docker compose"' >> ~/.bashrc && source ~/.bashrc

Conclusion

You now have a complete Docker and Docker Compose environment running on Ubuntu 26.04 LTS. The installation uses Docker’s official repository which ensures you receive the latest engine releases (Docker 29.4.0), Compose (v5.1.2), and Buildx — all maintained and updated by Docker directly.

From here, explore Docker Hub for pre-built images, write your own Dockerfiles to containerise your applications, and use Docker Compose to define multi-service stacks that can be started with a single command. Containerisation with Docker on Ubuntu 26.04 brings the same environment consistency from development to production — eliminating the classic “works on my machine” problem permanently.

💻 Need help with your Linux server?

Visit To Me provides professional Linux server management, Docker environment setup, and DevOps automation — worldwide remote support with a fixed-price quote within 24 hours.

Request a Free Quote →

Muhammad Irfan Aslam

Muhammad Irfan Aslam is an IT professional and technology writer based in Riyadh, Saudi Arabia. With expertise in IT infrastructure, cybersecurity, and cloud solutions, he helps Saudi businesses navigate digital transformation aligned with Vision 2030. He covers enterprise IT services, managed support, and emerging technologies for the GCC region.

Leave a Reply

Your email address will not be published. Required fields are marked *

Saudi Arabia’s IT intelligence hub — cybersecurity, cloud, infrastructure & digital transformation for Vision 2030 businesses.

Riyadh, Kingdom of Saudi Arabia
Sun–Thu  9:00 AM – 6:00 PM AST

Why Visit To Me

Google News publisher
Riyadh-based IT experts
Vision 2030 aligned
NCA compliance coverage
Arabic & English content
Free IT Consultation →
© 2026 Visit To Me · IT HUB · Riyadh, Kingdom of Saudi Arabia · All rights reserved.
💼
Visit Pro
AI Sales Assistant · Visit To Me
Powered by Claude AI · Visit To Me