Skip to content
ohsudo, Home
Docker & Containers

docker: 'compose' is not a docker command (and docker-compose: command not found)

Fix "docker: 'compose' is not a docker command" and "docker-compose: command not found": install the Compose plugin, check its folder, and move from docker-compose v1.

Beginner3 min readApplies to Docker Engine 24+ · Docker Compose v2+ · Ubuntu · Debian · RHEL / Rocky / AlmaLinux · Docker Desktop

by OhSudo ·

Checked on real software: Docker 29, Ubuntu 24.04 · November 2026How we check

Part of a learning path:Docker: from first container to production

$ docker compose up -d
docker: unknown command: docker compose
Run 'docker --help' for more information

Older Docker versions say it this way:

docker: 'compose' is not a docker command.
See 'docker --help'

And on systems that only had the old tool:

$ docker-compose up -d
bash: docker-compose: command not found

On Ubuntu, the shell may suggest sudo apt install docker-compose. That package is the old v1, so install the plugin below instead.

Docker Compose isn’t part of the docker command itself. Today it’s a plugin: a separate program that docker finds in its plugins folder, and then docker compose works. The old docker-compose (with a hyphen) was a separate Python tool, and it hasn’t been maintained since 2023.

TL;DR

Terminal window
# Ubuntu / Debian, with Docker's own repository
sudo apt-get install docker-compose-plugin
# RHEL / Rocky / Fedora, with Docker's own repository
sudo dnf install docker-compose-plugin
docker compose version

1. Install the plugin

Which package you need depends on where your Docker came from:

Terminal window
apt-cache policy docker-ce docker.io 2>/dev/null | grep -E '^[a-z]|Installed'
  • Docker’s repository (docker-ce, from download.docker.com): install docker-compose-plugin, as above.
  • Ubuntu’s own packages (docker.io): install docker-compose-v2, the plugin as Ubuntu packages it, on Ubuntu 24.04 and later.
  • Docker Desktop (Windows, macOS, Linux) includes Compose. If it’s missing there, update or reinstall Desktop. In WSL, turn on the distribution under Settings → Resources → WSL integration.

Then check it:

Terminal window
docker compose version

2. Install it by hand

Without a package, put the binary from Compose’s GitHub releases in a plugins folder: ~/.docker/cli-plugins/ for your user, or /usr/local/lib/docker/cli-plugins/ for everyone:

Terminal window
mkdir -p ~/.docker/cli-plugins
curl -fSL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
docker compose version

The file must be named docker-compose and be executable. Use docker-compose-linux-aarch64 on ARM servers. If docker compose still fails, look for it in the folders Docker searches: /usr/libexec/docker/cli-plugins/, /usr/lib/docker/cli-plugins/, and the two above.

3. Scripts that call docker-compose

docker compose reads the same docker-compose.yml and compose.yaml files, so most of the time, replacing docker-compose with docker compose in scripts is the whole change. Two things to know:

  • Container names use - where v1 used _: shop-web-1, not shop_web_1. Scripts that call containers by name need updating.
  • The version: key at the top of the file is obsolete. Compose ignores it and prints a warning.

For a script you can’t change, a small wrapper named docker-compose keeps it working:

Terminal window
printf '#!/bin/sh\nexec docker compose "$@"\n' | sudo tee /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

4. It works for you, and not with sudo (or the other way)

A plugin in ~/.docker/cli-plugins/ belongs to your user. sudo docker compose runs as root, which looks in /root/.docker/cli-plugins/ and doesn’t find it. Install the plugin system-wide (the package, or /usr/local/lib/docker/cli-plugins/), or join the docker group and drop sudo, as in permission denied on docker.sock.

The Docker Compose Generator writes a ready compose.yaml for both, without the old version: key.

Shell, we have a problem!

Similar, but different: Cannot connect to the Docker daemon means Compose runs, and the Docker service doesn’t. no configuration file provided: not found means Compose works, and there’s no compose.yaml in this folder or its parents. mapping values are not allowed in this context is a YAML error in the file. With Podman, use podman compose. A Compose that runs and rejects your file with Additional property … is not allowed is a key it doesn’t know. For everyday commands, see the Docker Compose cheat sheet. The docker run ⇄ Compose Converter turns your docker run commands into a compose file, and back.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Tools

Try it yourself

Articles

Related articles