AdrienW
AdrienW

Reputation: 3452

Cannot install Docker Compose v2: "Invalid Plugin, exec format error"

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?

Upvotes: 7

Views: 14134

Answers (2)

t-my
t-my

Reputation: 113

I mistakenly ended up downloading the aarch64 binaries. Github releases didn't show them all and I had to click the "show more button" below the releases.

After redownloading the correct binaries everything started working as expected.

Upvotes: 0

AdrienW
AdrienW

Reputation: 3452

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.

Upvotes: 7

Related Questions