Black Friday Sale - Up to 41% OFF

How to Install Docker Compose on Ubuntu 26.04

How to Install Docker Compose on Ubuntu 26.04
Published on Sep 29, 2026 Updated on Oct 16, 2026

Traditional container management often involves running multiple docker commands with dozens of flags. Complexity increases as containers grow, and often, this leads to errors. Docker Compose addresses these challenges by replacing manual CLI commands with a single configuration file.

With just a single command, Docker Compose, built on top of Docker, pulls images and spins up containers, networks, and volumes. The result is a faster and more consistent setup (whether on a personal laptop or in production) with fewer errors than the manual approach. Let’s explore Docker Compose in more detail.

#What is Docker Compose?

Docker Compose is an open-source tool maintained by Docker as part of the core Docker ecosystem. It defines and runs multi-container Docker applications. You describe your app's services, networks, and volumes in a single YAML file, then spin up the entire stack with a single command.

Modern versions of Docker Compose ship as a Docker CLI plugin, not as a separate binary. This is Docker Compose V2, invoked as docker compose (without a hyphen) instead of the older docker-compose command. It's faster than its predecessor and is actively developed.

#Prerequisites

Before setting sail, ensure you have the following in place:

  • A server instance of Ubuntu 26.04. To follow along, you can deploy a high-performance VPS server at Cherry Servers within minutes.

  • SSH access to the server with a sudo user configured

Scalable VPS Hosting

Deploy fast, secure VPS for websites, apps, and dev environments. Scale on demand, manage with full root access, and get 24/7 expert support.

#Installing Docker Compose on Ubuntu 26.04

This tutorial provides step-by-step instructions for installing Docker Compose on Ubuntu 26.04. Following installation, we will demonstrate its practical use by deploying several sample services and reviewing the Docker Compose commands most frequently used in day-to-day operations.

#Method 1: Installing Docker Compose from Docker’s Official Repository

Installing Docker Compose from the default Docker repository is the most recommended option, and for good reasons. First, you get the latest version. The default Ubuntu repositories can be several minor (or even major) versions behind what Docker currently ships. Installing from Docker's own repo always guarantees the latest build.

More importantly, Docker repositories offer Compose v2 (the plugin-based Docker Compose), which gets new features and bug fixes on Docker's release cadence. The Ubuntu-packaged version may miss essential dependencies, features, or improvements available in current Docker Compose releases.

To get started installing Docker Compose from Docker’s Official repository, update the local package index:

Command Line
sudo apt update

The command refreshes the local index of available packages from your currently configured repositories. This is the standard practice before installing anything, especially if you are starting with a fresh VPS or local machine.

Next, install the required prerequisites.

Command Line
sudo apt install -y ca-certificates curl
OutputUpgrading:
  ca-certificates  curl  libcurl3t64-gnutls  libcurl4t64

Summary:
  Upgrading: 4, Installing: 0, Removing: 0, Not Upgrading: 120
  Download size: 1254 kB
  Freed space: 43.0 kB

Next, create the keyrings directory. This is the standard location modern Debian/Ubuntu systems use to store trusted keys for third-party repositories.

Command Line
sudo install -m 0755 -d /etc/apt/keyrings

Now, download Docker's GPG public key and save it into that keyrings folder.

Command Line
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

This key lets apt verify that packages actually came from Docker and weren't tampered with in transit. You can preview the public key by running:

Command Line
cat  /etc/apt/keyrings/docker.asc

Next, make the key file readable by all users. This lets the aptpackage manager read this file when it verifies packages.

Command Line
sudo chmod a+r /etc/apt/keyrings/docker.asc

Once the GPG key is in place with the correct permissions, add the Docker repository.

Command Line
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

Re-run the apt update command to pick up the newly added Docker repository.

Command Line
sudo apt update

Then install Docker Compose and the Compose plugin by running the following commands:

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

The command installs the following components:

  • docker-ce: This is the Docker Community Edition engine. It provides the Docker daemon (dockerd) that builds and runs containers.

  • docker-ce-cli: This is Docker's command-line client that communicates with the Docker Daemon via API requests. It lets you manage Docker and Docker resources (e.g., containers and images) by running docker commands (e.g., docker run, docker ps, docker rm, etc.).

  • containerd.io: A low-level container runtime that actually runs your containers. It manages container lifecycles (starting/stopping/isolating processes).

  • docker-buildx-plugin: Adds docker buildx, an extended build tool supporting multi-platform builds, caching improvements, and BuildKit features.

  • docker-compose-plugin: Adds Docker Compose (the modern, plugin-based version of Compose, invoked without a hyphen) for defining and running multi-container applications.

Here’s a preview of the output expected.

OutputInstalling:
  containerd.io  docker-buildx-plugin  docker-ce  docker-ce-cli  docker-compose-plugin

Installing dependencies:
  docker-ce-rootless-extras  pigz

Suggested packages:
  cgroupfs-mount  | cgroup-lite  docker-model-plugin

Summary:
  Upgrading: 0, Installing: 7, Removing: 0, Not Upgrading: 120
  Download size: 102 MB
  Space needed: 395 MB / 38.1 GB available

Once the installation is complete, configure the logged-in user to run Docker commands without invoking sudo

Command Line
sudo usermod -aG docker $USER
newgrp docker

To verify Docker Compose is installed, run the command below. Note that Docker Compose V2 is bundled as a CLI plugin and invoked as docker compose (with a space, not a hyphen).

Command Line
docker compose version
OutputDocker Compose version v5.5.0

Since Docker was also installed, you can confirm its version as well

Command Line
docker --version
OutputDocker version 29.7.2, build a7dcaa6

#Method 2: Installing Docker Compose from Ubuntu’s APT Repository

The first installation option guarantees the latest version of Docker Compose. If you don't need the bleeding-edge version, Ubuntu's own repository works fine, and you can install it by running the following commands:

Command Line
sudo apt update
sudo apt install docker-compose-v2

This automatically pulls in Docker Compose, Docker Engine, and their dependencies and receives updates through the normal Ubuntu update cycle. The only difference here is that you get a version that is less up to date than Docker’s own repository.

Next, add the user to the docker group and enable them to run docker commands without invoking sudo.

Command Line
sudo usermod -aG docker $USER
newgrp docker

#Deploying a Sample App with Docker Compose

With Docker Compose now installed, it's time to put it to the test. Create a project folder and navigate into it. In this case, test-project is the folder’s name.

Command Line
mkdir  test-project && cd test-project

This is the folder structure.

Command Line
test-project/
  ├── docker-compose.yml
  └── html/
             └── index.html

Here’s the Docker Compose YAML file. It runs two services: an Nginx web server that communicates with Redis, an open-source in-memory cache.

services:
  web:
    image: nginx:alpine
    ports:
      - "8080:80"
    volumes:
      - ./html:/usr/share/nginx/html:ro
    depends_on:
      - redis
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

Inside the html folder, create the index.hml file with the following lines of code.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Docker Compose Sample App</title>
  <style>
    body { font-family: sans-serif; text-align: center; margin-top: 10%; background: #f4f6f8; }
    h1 { color: #2496ED; }
  </style>
</head>
<body>
  <h1>🐳 Hello from Docker Compose!</h1>
  <p>This page is served by an Nginx container defined in docker-compose.yml.</p>
  <p>A Redis container is also running alongside it on port 6379.</p>
</body>
</html>

With the files in place, run the following command to start the services.

Command Line
docker compose up -d

The command pulls the images required to start the services, creates a network for the services to communicate, and spins up the containers.

Next, open http://server-ip:8080. You'll see the sample page served by Nginx, with a Redis container running alongside it on port 6379.

docker-compose-test-app

You can run a few follow-up commands to ensure everything is working perfectly.

To view all running services, run the following:

Command Line
docker compose ps 

You can also view running containers using the docker ps command as shown.

Command Line
docker ps

To view service logs, execute:

Command Line
docker compose logs

To follow logs for all services in real time, run the following:

Command Line
docker compose logs -f 

To stop services or containers without removing them, run:

Command Line
docker compose stop

To start previously stopped services or containers, run:

Command Line
docker compose start

To restart all services/containers, run:

Command Line
docker compose restart

To restart a specific service only, for example, a service named web, run:

Command Line
docker compose restart web

To stop and remove all services, including containers and networks, run:

Command Line
docker compose down

To remove everything, including images used by services, run:

Command Line
docker compose down --rmi all

#Conclusion

This tutorial walked you through installing Docker Compose on Ubuntu 26.04. We looked at installing Docker Compose from the official Docker repository, which guarantees the latest version. If you don’t mind Docker Compose being a few versions behind, you can install it from the Ubuntu APT repository.

From here, you can launch your applications/services by explicitly specifying them in a YAML file or even a Dockerfile and manage them easily without the complexities associated with manually running docker commands. Refer to the official Docker Compose documentation for more information.

Read Next

Cloud VPS Hosting

Starting at just $3.51 / month, get virtual servers with top-tier performance.

Share this article

Related Articles

Published on Jul 20, 2026 Updated on Jul 21, 2026

How to Install Docker on Ubuntu 26.04: Step-by-Step Guide

Learn how to install Docker on Ubuntu 26.04 with this step-by-step guide. Set up Docker, Compose, containers, commands, troubleshooting, and best practices.

Read More
Published on Mar 25, 2026 Updated on Mar 26, 2026

Docker Copy Command: Copy Files and Directories in Docker

Learn how to use the Docker COPY command with practical examples. Copy files, directories, and apply best practices for secure, efficient Docker builds.

Read More
Published on Sep 12, 2025 Updated on Apr 17, 2026

Docker Compose Cheat Sheet: Key Commands Guide

Learn Docker Compose commands to easily deploy and manage multi-container apps, scale services, and set up full-stack environments using a single YAML file.

Read More
No results found for ""
Recent Searches
Navigate
Go
ESC
Exit