5

I installed the new docker compose CLI according to the instructions on docs.docker.com (Ubuntu 20.04) and cannot use the plugin.

The command docker compose help shows:

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

When running docker help, I get:

$ docker help

Usage:  docker [OPTIONS] COMMAND

[[ OMMITTED NORMAL OUTPUT ]]

Invalid Plugins:
  compose     failed to fetch metadata: fork/exec /home/myname/.docker/cli-plugins/docker-compose: exec format error

Run 'docker COMMAND --help' for more information on a command.

To get more help with docker, check out our guides at https://docs.docker.com/go/guides/

Same when installing under /usr/local/lib/docker/cli-plugins and running the command as root.

I currently use docker version 20.10.7 and docker-compose version 1.28.0.

What am I doing wrong? How to get the new compose to work?

AdrienW
  • 3,092
  • 6
  • 29
  • 59
  • The error message has a plugin filename and `exec format error`; what kind of file exactly is the plugin? Do you need to decompress it, or unpack a tar file, or something else? – David Maze Oct 11 '21 at 10:19
  • @DavidMaze it is a binary file that gets downloaded from https://github.com/docker/compose/releases/tag/v2.0.0 -- according to the docs on the linked website, no unpacking is needed, only `chmod +x` – AdrienW Oct 11 '21 at 10:22
  • 2
    Have you checked? `file ~/.docker/cli-plugins/docker-compose`? – David Maze Oct 11 '21 at 10:24
  • @DavidMaze :o you're right: the link is wrong, no asset with this name exists in release 2.0.0! Was fixed in 2.0.1 apparently... I wrongly assumed that `curl` would crash if the link was invalid. – AdrienW Oct 11 '21 at 10:28

1 Answers1

7

The problem is solved with version 2.0.1 instead of 2.0.0

Until the docs get updated, just change the cURL command to download the newer version:

curl -SL https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

The cause is a missing asset in the Github Release.

Works like a charm:

$ docker compose version
Docker Compose version v2.0.1

EDIT: as of October 26th 2021, the documentation has been updated to link to the correct download-artifact. This answer remains valid for the case when artifacts are missing, which may happen with future versions or other plugins.

AdrienW
  • 3,092
  • 6
  • 29
  • 59