TechBuzzPro

Install Docker Compose on CentOS: Step-by-Step

· 5 min read · Apps & Browsers

In this article
  1. What Is Docker Compose?
  2. Prerequisites
  3. Install Docker Compose v2 (Recommended)
  4. Install Docker Compose v1 (Legacy)
  5. Common Installation Errors and Fixes
  6. How to Update or Uninstall
  7. Basic Usage Example
  8. Frequently Asked Questions

Yes, you can install Docker Compose on CentOS by downloading the binary from GitHub, making it executable, and moving it into your PATH. This guide covers both Docker Compose v2 (the current plugin) and the legacy standalone v1, with steps for CentOS 7, 8, and 9. You'll also learn how to verify the install, fix common errors, and keep the tool updated.

What Is Docker Compose?

Docker Compose is a tool that lets you define and run multi-container Docker applications. Instead of running several docker run commands, you write a docker-compose.yml file that describes services, networks, and volumes. One command — docker compose up — starts everything.

It is especially useful for local development stacks (e.g., a web app with a database and cache) and for automating test environments. Compose does not replace Docker itself; it works on top of the Docker Engine, using the same APIs.

Prerequisites

  • A CentOS system (7, 8, or 9) with a non-root user that has sudo privileges.
  • Docker Engine already installed. If you don't have it, install it first with: sudo yum install -y yum-utils then sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo and sudo yum install -y docker-ce docker-ce-cli containerd.io.
  • Internet access to download the binary.

Docker Compose v2 is a plugin that integrates with the docker CLI. It is the current standard and receives regular updates. The easiest way to install it on CentOS is to download the binary from the official GitHub releases page.

  1. Visit the Docker Compose releases page to find the latest version number (e.g., v2.24.0).
  2. Download the binary for Linux x86_64 (or aarch64 if you're on ARM):
    sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  3. Apply executable permissions:
    sudo chmod +x /usr/local/bin/docker-compose
  4. Verify the installation:
    docker-compose --version

This installs the standalone binary, which works with the docker-compose command. For the plugin version (invoked as docker compose), you can install via the Docker repository:

sudo yum install -y docker-compose-plugin

After that, docker compose version should work. Both approaches are valid; the plugin version is more integrated with the Docker CLI, while the standalone binary is easier to update manually.

Install Docker Compose v1 (Legacy)

Docker Compose v1 (the Python-based version) is deprecated and no longer receives updates. It is only worth installing if you have an older script that relies on it. The installation is similar:

  1. Download the v1 binary (e.g., 1.29.2):
    sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  2. Make it executable and verify:
    sudo chmod +x /usr/local/bin/docker-compose
    docker-compose --version

If you already have v2 installed, you can skip v1 entirely. Mixing both can cause confusion, so choose one and stick with it.

Common Installation Errors and Fixes

  • Permission denied when running docker-compose: the binary is not executable. Run sudo chmod +x /usr/local/bin/docker-compose.
  • Command not found: the binary is not in your PATH. Check with which docker-compose. If it's not there, ensure you moved it to /usr/local/bin (which is usually in PATH) or add the directory to your PATH.
  • curl: (35) SSL connect error: this happens on older CentOS 7 systems with outdated CA certificates. Update with sudo yum update -y ca-certificates and retry.
  • Exec format error: you downloaded the wrong architecture. Use uname -m to check if you need x86_64 or aarch64.
  • Version mismatch: if you have both v1 and v2, the command docker-compose might point to an old binary. Check with docker-compose --version and remove the one you don't need.

How to Update or Uninstall

Updating Docker Compose is straightforward: download the new binary over the old one. For the standalone version, repeat the same curl command with the new version number. For the plugin, use sudo yum update docker-compose-plugin.

To uninstall, simply remove the binary:
sudo rm /usr/local/bin/docker-compose
If you installed the plugin, remove it with sudo yum remove docker-compose-plugin.

Basic Usage Example

After installation, create a simple docker-compose.yml file to test it:

version: '3.8'
services:
  web:
    image: nginx:latest
    ports:
      - "8080:80"

Then run docker-compose up -d to start the container in the background. Visit http://localhost:8080 to see the nginx welcome page. To stop, use docker-compose down.

This example uses the nginx image, which is a common web server. You can replace it with any image from Docker Hub.

Frequently Asked Questions

Can I install Docker Compose on CentOS 6?

CentOS 6 reached end-of-life in November 2020 and is not supported by Docker Engine or Compose. You would need an older version of Docker (1.7) and a Python-based Compose, but it is not recommended for security reasons. Upgrade to CentOS 7 or later.

What is the difference between docker-compose and docker compose?

docker-compose (with a hyphen) is the standalone binary, while docker compose (with a space) is the plugin version integrated into the Docker CLI. Both read the same YAML file and have similar commands. The plugin version is the current standard and receives updates alongside Docker Engine.

Do I need to install Docker Compose separately if I already have Docker?

Yes, Docker Compose is not included in the base Docker Engine installation on CentOS. You must install it separately, either as a plugin or standalone binary. Some Docker packages (like Docker Desktop) include Compose, but on a server you need to add it manually.

Why does my docker-compose up command fail with "version is obsolete"?

This warning appears when your docker-compose.yml uses an old version key (like version: '2'). It is not an error — Compose still works, but the warning suggests you remove the version line. Modern Compose ignores the version key entirely.

Can I use Docker Compose with Podman on CentOS?

Podman has its own compatibility tool called podman-compose, which mimics Docker Compose. It is not the same as Docker Compose, but it can run most Compose files. If you prefer Podman, install podman-compose from EPEL instead.

Is Docker Compose free to use?

Yes, Docker Compose is open-source and free. The source code is available on GitHub under the Apache 2.0 license. You can use it for personal and commercial projects without cost.