dockerubuntudocker-compose

docker: 'compose' is not a docker command Ubuntu 24.04 LTS


I tried to run

docker compose up

on a Ubuntu 24.04 LTS system and encountered the error

docker: 'compose' is not a docker command

The current docker --version is 24.0.7 which appears to be a current or very recent version.

Docker migrated away from the old docker-compose Python CLI quite some time ago, so I'm not sure why this isn't working.

Do I possibly need to install another apt package?

A search of apt-cache search docker | grep compose gives the following results.

docker-compose - define and run multi-container Docker applications with YAML
docker-compose-v2 - tool for running multi-container applications on Docker
podman-compose - Run docker-compose.yml using podman
python3-compose - Python implementation of docker-compose file specification

Solution

  • docker-compose-v2 is the required apt package. Install it with

    sudo apt install docker-compose-v2
    

    The full list of packages to install is

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

    see the official documentation