compose: docker --context default compose reports unknown docker command: "compose compose" for 2.0.1 but not 2.0.0

I’m going to ignore the instructions due to lack of time. Please close this issue immediately if this does not benefit the community. I wasn’t able to find this in previous issues which I find very surprising.

After installing 2.0.1 over 2.0.0 (via overwriting ~/.docker/cli-plugins/docker-compose with the release binary), the command: docker --context default compose reports the usage / help text but the bottom says:

unknown docker command: “compose compose”

Ubuntu 20.10 x86_64 5.8.0-63-generic virtualbox-from-windows10 Server version 20.10.8 runc version: v1.0.1-0-g4144b63 Experimental: true

This “unknown docker command” happens for every docker compose command that passes in --context default. It does not happen if I leave out that switch.

If it’s user error, the error message needs to speak more truth than accusing me of typing compose twice.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 18 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Actually, setting DOCKER_CONTEXT also works. (for Docker Compose version v2.1.1)

You could drop the --context parameter, and then export the DOCKER_HOST environment variable explicitly.

:hat-tip: Thank you @W1M0R 🙇

While this syntax got the error:

% docker --host "$_host" compose --file svc01-stack.yml ps
...
unknown docker command: "compose compose"

This syntax succeeded:

% DOCKER_HOST="$_host" docker compose --file svc01-stack.yml ps   
NAME                COMMAND             SERVICE             STATUS              PORTS
svc01-svc01-1       "/init"             svc01               running             

Same result on 2.1.1 🤦‍♂️

@rosmcmahon don’t do that. flags you pass to docker-compose are not the same you pass to docker compose as some target the root command docker (like --context)

Ok… I’m hearing don’t do that, but not what to do?

  • FYI, I don’t have docker-compose v1 installed, if that makes a difference.
  • More extra info, I use --context like: docker --context myecs compose ...
  • using above alias fixes commands docker context create ecs ecs --from-env <= I’m totally unclear as to why 😅

Thanks for replying above, I appreciate it

Confirmed fixed by OP in 2.2.3 (did not try 2.2.2). Feel free to close.

P.S. THANK YOU!

Why was this closed? The issue still exists on v2.2.1.

docker --context remote compose version

Run 'docker compose COMMAND --help' for more information on a command.
unknown docker command: "compose compose"

Edit: Unless https://github.com/docker/compose/pull/8985 is supposed to have fixed this in 2.2.2?

You could drop the --context parameter, and then export the DOCKER_HOST environment variable explicitly.