Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "docker compose" and "docker-compose"

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

like image 839
Veverke Avatar asked Mar 07 '21 08:03

Veverke


People also ask

Is there a difference between Docker compose and Docker compose?

In summary, Docker is the underlying technology used to create images and run them as containers, and Docker Compose is a tool that configures how Docker should run multiple containers to serve our application.

What is the difference between Docker compose and docker Swarm?

Docker Compose is used for configuring and starting multiple Docker containers on the same host–so you don't have to start each container separately. Docker swarm is a container orchestration tool that allows you to run and connect containers on multiple hosts.

What Docker compose means?

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.

What is the difference between dockerfile and compose?

A Dockerfile is a text document that contains all the commands/Instruction a user could call on the command line to assemble an image. Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services.

What is Docker-Compose and how to use it?

It's a client application to the docker daemon server, kind of like the docker CLI client, but instead of typing the whole run commands every time, with docker-compose you can re-use the same YAML file over and over again, and deploy the same container with the same configuration as you did in the first time.

How do I run an app in Docker Compose?

Using Compose is basically a three-step process: Define your app’s environment with a Dockerfile so it can be reproduced anywhere. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment. Run docker-compose up and Compose starts and runs your entire app.

What is the most recent version of Docker Compose?

It has to be the most recent one, which is 3 at the time of writing, while Docker Compose still can handle versions 2 and 3 without problems. Both docker-compose and the new docker stack commands can be used with docker-compose.yml files which are written according to the specification of version 3.


Video Answer


4 Answers

The docker compose (with a space) is a newer project to migrate compose to Go with the rest of the docker project. This is the v2 branch of the docker/compose repo. It's been first introduced to Docker Desktop users, so docker users on Linux didn't see the command. In addition to migrating to Go, it uses the compose-spec, and part of the rewrite may result in behavior differences.

The original python project, called docker-compose, aka v1 of docker/compose repo, has now been deprecated and development has moved over to v2. To install the v2 docker compose as a CLI plugin on Linux, supported distribution can now install the docker-compose-plugin package. E.g. on debian, I run apt-get install docker-compose-plugin.

like image 111
BMitch Avatar answered Oct 16 '22 08:10

BMitch


Brandon Mitchell from docker's Captain Program 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

like image 25
Veverke Avatar answered Oct 16 '22 10:10

Veverke


Quote from https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command

Compose V2 and the new docker compose command
    Important
    The new Compose V2, 
which supports the compose command as part of the Docker CLI, is now available.

    Compose V2 integrates compose functions into the Docker platform, 
continuing to support most of the previous docker-compose features and flags. 
You can run Compose V2 by replacing the hyphen (-) with a space, 
using docker compose, instead of docker-compose.
like image 5
Russo Avatar answered Oct 16 '22 08:10

Russo


If it not yet included in the docker installation, 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

like image 2
Janux Avatar answered Oct 16 '22 09:10

Janux