17
votes

I have been using docker-compose, but noticed there is also a docker compose (without the dash).
I have not been able to quickly determine the differences between the two forms by googling.

Anyone?

docker compose's help:

enter image description here

docker-compose's help:

enter image description here

3
Where did you get the docker compose help page? As far as I know, compose is not a valid docker command.Maroun
From the same powershell console I get the help for the 2nd.Veverke
docker compose is the compose sub-command of the docker executable (which doesn't exist in this list docs.docker.com/engine/reference/commandline/docker). docker-compose is a separate executable: docs.docker.com/compose/reference/overview.jonrsharpe
@jonrsharpe: what do you mean by sub-command ? Was it not supposed to be listed here ?Veverke
I don't think this should have been downvoted. It is a legitimate question, since it seems like "docker compose" is a valid command in the OPs terminal.DannyB

3 Answers

14
votes

The docker compose (with a space) is a newer project to migrate compose to Go with the rest of the docker project. You can follow the project at docker/compose-cli. It's been first introduced to Docker Desktop users, so docker users on Linux won't see the command. In addition to migrating to Go, it also adds support to integrate with ECS and ACI to deploy containers directly to the cloud.

For now both projects are being worked on concurrently, but my expectation is once docker compose gets feature parity with docker-compose, it will get integrated directly in the docker CLI, which would include Linux users, and we'll see docker-compose wind down.

4
votes

Brandon Mitchell from docker replied to the github issue I opened on this as follows:

The docker/compose-cli project is in an in-between state, where it's not available in upstream releases of the docker-cli Linux packages, but is being included in Docker Desktop. The documentation pages normally follow what's in the docker/cli, so having this released to Desktop early puts the documentation in a difficult position. I'm going to raise this issue with the Docker team to see how they'd like to handle it.

Update: from docker github issue:

gtardif commented 2 days ago

compose command reference doc is now live

new docker-compose command reference

0
votes

docker compose can be installed on Linux as CLI plugin.

COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.tag_name')

DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

See https://docs.docker.com/compose/cli-command/#installing-compose-v2