DEV Community

Discussion on: Bug: Docker-compose up?

Collapse
 
ajeetraina profile image
Ajeet Singh Raina

The difference between docker-compose and docker compose lies in the versions of Docker Compose and the language they were written in.

docker-compose refers to version one of Docker Compose, which was first released in 2014 and written in Python. This version typically includes a top-level version element in the compose.yml file, with values ranging from 2.0 to 3.8, referring to the specific file formats.
On the other hand, docker compose refers to version two of Docker Compose, which was announced in 2020 and written in Go. This version ignores the version top-level element in the compose.yml file.

For most projects, switching to Compose V2 requires no changes to the Compose YAML or your development workflow. It's recommended to use docker compose instead of docker-compose as it provides additional flexibility and removes the requirement for a docker-compose compatibility alias. However, Docker Desktop continues to support a docker-compose alias to redirect commands to docker compose for convenience and improved compatibility with third-party tools and scripts.

To switch to Compose V2, the easiest and recommended way is to make sure you have the latest version of Docker Desktop, which bundles the Docker Engine and Docker CLI platform including Compose V2. With Docker Desktop, Compose V2 is always accessible as docker compose. Additionally, the Use Compose V2 setting is turned on by default, which provides an alias from docker-compose.

Collapse
 
fabiobazurtobla profile image
Fabio Bazurto Blacio • Edited

You are right. I noticed this docker compose was included into my docker context rather than Py package.
You can check it by executing:
docker-compose version
and
docker compose version

They are pointing to a different context (inside/outside docker)

Thank you so much for this information @ajeetraina