Installing docker compose v2 via docker-compose-plugin

mq flag

I have installed docker-ce, docker-compose and the docker-compose-plugin package on Ubuntu 22.04 from the Docker apt repository, following the official instructions, but when I type docker compose on the command line all I get is this:

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

According to docker plugin ls, no plugin has been installed. Any clues?

Some additional information:

  • bash-completion does suggests compose as a possible subcommand
  • There is a working docker-compose executable in /usr/libexec/docker/cli-plugins/
  • The output of dpkg -l | grep docker is as follows:
    ii  docker-buildx-plugin                                        0.10.2-1~ubuntu.22.04~jammy                                    amd64        Docker Buildx cli plugin.
    ii  docker-ce                                                   5:23.0.1-1~ubuntu.22.04~jammy                                  amd64        Docker: the open-source application container engine
    ii  docker-ce-cli                                               5:23.0.1-1~ubuntu.22.04~jammy                                  amd64        Docker CLI: the open-source application container engine
    ii  docker-ce-rootless-extras                                   5:23.0.1-1~ubuntu.22.04~jammy                                  amd64        Rootless support for Docker.
    ii  docker-compose-plugin                                       2.16.0-1~ubuntu.22.04~jammy                                    amd64        Docker Compose (V2) plugin for the Docker CLI.
    ii  docker-scan-plugin                                          0.23.0~ubuntu-jammy                                            amd64        Docker scan cli plugin.
dummyuser avatar
uy flag
Hi Aldo, 1) please edit your question and add the result of `dpkg -l | grep docker` 2) how did you install docker itself ?
Aldo avatar
mq flag
Hi @dummyuser, thank you for answering. I installed docker via apt from the repository following the instruction on the webpage mentioned above.
Artur Meinild avatar
vn flag
Please add output of `docker info`, `docker version` and `snap list` ..
Aldo avatar
mq flag
Thank you @ArturMeinild, you pointed me in the right direction! In the output of `docker info` there was the line ``` WARNING: Plugin "/home/aldo/.docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /home/aldo/.docker/cli-plugins/docker-compose: permission denied ``` For some reason that file was a text file with only "Not Found" in it. After I got rid of it `docker compose` started working, and the output of `docker info` now points to the plugins in `/usr/libexec/docker/cli-plugins/`
Artur Meinild avatar
vn flag
That's good to hear. Please post your findings as an answer, as it might help others. Thanks!
mq flag

Examination of the output of docker info led me to the solution to the problem. It did indeed contain the line:

WARNING: Plugin "/home/aldo/.docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /home/aldo/.docker/cli-plugins/docker-compose: permission denied

I'm not sure what might have created it, but in the directory ~/.docker/cli-plugins/ there was a docker-compose text file, only containing the words "Not Found". Simply deleting it solved my problem, and now docker finds the default path to the plugin executable /usr/libexec/docker/cli-plugins/docker-compose.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.