TExcelTAD
Home › Docker Compose › Installing Compose

Installing Compose

Compose is not a separate server or daemon. It is a CLI plugin: a single executable called docker-compose that the Docker CLI finds in a plugins folder and exposes as the docker compose sub-command. Compose talks to the same Docker Engine as docker run, through the same socket or context. If you already have Docker working (see Docker Install), getting Compose is usually one package or already done.

text
  you ──▶ docker compose up ──▶ docker CLI ──▶ plugin: docker-compose ──▶ Docker Engine API ──▶ containers
                                      (finds it in ~/.docker/cli-plugins or /usr/libexec/docker/cli-plugins)

Pick your platform

Platform How you get Compose
Docker Desktop (Windows, macOS, Linux) Included and updated with Desktop. Nothing to do.
Linux with Docker's apt/dnf repository Install the package docker-compose-plugin (it usually comes with docker-ce)
Linux, no package manager access Download the release binary into a cli-plugins folder
CI runners (GitHub Actions, GitLab) Most hosted images already ship the plugin; check with docker compose version

On Debian or Ubuntu, after adding Docker's official repository as the Docker course describes:

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

On Fedora, RHEL and friends the package has the same name:

bash
$ sudo dnf install docker-compose-plugin

Distribution packages (for example Ubuntu's own docker-compose-v2 or docker-compose) can lag behind. For a course like this one, which uses recent features such as include, develop.watch and env_file with required, Docker's own repository is the safer choice.

Manual install for one user

If you can't use a package, put the binary in your personal plugins folder. The file must be named docker-compose for the CLI to find it as a plugin:

bash
$ mkdir -p ~/.docker/cli-plugins
$ curl -fsSL -o ~/.docker/cli-plugins/docker-compose \
    https://github.com/docker/compose/releases/download/<version>/docker-compose-linux-x86_64
$ chmod +x ~/.docker/cli-plugins/docker-compose

Replace <version> with a release tag from the Compose releases page and pick the file for your CPU (-x86_64 or -aarch64). A system-wide install goes into /usr/local/lib/docker/cli-plugins instead.

Check the installation

bash
$ docker compose version
Docker Compose version v5.6.1
$ docker version --format '{{.Server.Version}}'
29.9.2

(Sample output: your versions will differ.) If you see docker: 'compose' is not a docker command, the plugin is missing or not executable, or it sits in a folder the CLI does not search.

docker-compose vs docker compose

docker-compose (hyphen) docker compose (space)
What it is Compose v1, written in Python Compose v2 and later, written in Go, a Docker CLI plugin
Status End of life since 2023, no updates Current
Container names shop_web_1 (underscores) shop-web-1 (hyphens)
File format numbered version: "3.x" formats the Compose Specification, no version key

Old scripts and CI jobs still call docker-compose. Rather than reinstall v1, you can make that name point to the plugin, because the plugin binary also works on its own:

bash
$ sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
$ docker-compose version
Docker Compose version v5.6.1

Do it only for compatibility; new scripts should use docker compose.

A first sanity check that needs no images

docker compose config is the perfect first command after an install. It parses and validates a file, but does not pull images or start containers, so it works even offline. The --services flag lists the services Compose found:

compose · try it yourself
# $ docker compose config --services
# $ docker compose config --images
services:
  web:
    image: nginx:1.29
  api:
    build: ./api
  db:
    image: postgres:18
$ docker compose config --services
api
db
web
$ docker compose config --images
demo-api
nginx:1.29
postgres:18

Notice the api service. It has no image, only a build section, so Compose invents an image name from the project and the service: demo-api. That is the tag the built image will get. You will see why that matters in Services: image & build.

Which version do I need?

Compose adds features in minor releases, and an older plugin rejects keys it doesn't know. When a teammate's file fails with a schema error on develop (older plugins worded it additional properties 'develop' not allowed; current ones print services.<name>.develop false schema), the cause is usually an outdated plugin. The model below checks a plugin version against the features a file uses. The minimum versions are the releases that introduced each feature.

python · try it yourself
FEATURES = {
    "depends_on.required": (2, 20, 0),
    "include": (2, 20, 0),
    "develop.watch": (2, 22, 0),
    "env_file.required / format": (2, 24, 0),
    "!reset and !override tags": (2, 24, 4),
}

def parse(version):
    return tuple(int(part) for part in version.lstrip("v").split("."))

def check(installed, used):
    have = parse(installed)
    print(f"Compose {installed}")
    for feature in used:
        need = FEATURES[feature]
        ok = have >= need
        mark = "ok " if ok else "OLD"
        print(f"  [{mark}] {feature:28} needs >= {'.'.join(map(str, need))}")

check("v2.17.3", ["include", "develop.watch"])
check("v5.6.1", list(FEATURES))
Compose v2.17.3
  [OLD] include                      needs >= 2.20.0
  [OLD] develop.watch                needs >= 2.22.0
Compose v5.6.1
  [ok ] depends_on.required          needs >= 2.20.0
  [ok ] include                      needs >= 2.20.0
  [ok ] develop.watch                needs >= 2.22.0
  [ok ] env_file.required / format   needs >= 2.24.0
  [ok ] !reset and !override tags    needs >= 2.24.4

Python compares tuples element by element, so (2, 17, 3) >= (2, 20, 0) is false while (5, 6, 1) passes every check. A real-world habit: pin the minimum Compose version in your README or CI image, and run docker compose config -q in CI so an old plugin fails fast with a clear message.

Permissions and contexts

Compose uses whatever Docker endpoint the CLI uses:

  • On Linux, if docker ps needs sudo, so does docker compose. Adding yourself to the docker group removes the need, but that group is effectively root (see Docker Security). Rootless Docker is a safer alternative, and Compose works with it unchanged.
  • docker context use <name> or the DOCKER_HOST variable points both commands at a remote engine, for example DOCKER_HOST=ssh://deploy@server docker compose up -d. Bind-mount paths are then resolved on the remote machine, a common surprise covered in Compose in Production.

Learn more: Your First Compose App · The Compose CLI

Test yourself

What must the Compose plugin binary be called so that docker compose finds it?

  1. compose
  2. docker-compose, inside a cli-plugins folder
  3. docker_compose
  4. compose-plugin

Which image name does Compose give a service api in project demo that only has build: ./api?

  1. api:latest
  2. demo_api
  3. demo-api
  4. It refuses: image is required

Why is docker compose config a good first command after installing?

  1. It downloads all images
  2. It validates and prints the file without pulling or starting anything
  3. It upgrades the plugin
  4. It creates the default network