To docker compose and not docker-compose

Docker compose is a tool for orchestrating the deployment of multiple containers, including networking, storage, health monitoring, and much more. It is like a super-power for building experimental systems, especially since it uses a text-based configuration file that can be version controlled and is easy to share.

For many years I’ve been running ‘docker-compose’, until a colleague informed me that it has changed to ‘docker’ with ‘compose’ as separate words (i.e. compose is now a subprogram launched by the docker executable).

If like me, you missed the memo, the change is easy:

Old Way (deprecated)

docker-compose up

New Way

docker compose up

Why did Docker make this change?

Behind the scenes, Docker re-wrote compose, changing the language from Python to Go, and ‘docker compose’ is considered ‘version 2’ (different to the version of compose YAML file spec)1.

The old docker-compose executable is now unsupported, which is a good reason to switch to compose v2.

The format for docker-compose.yaml file has also been updated to the “Compose Specification”, and there are some other details, including some potentially breaking changes in behaviour at https://docs.docker.com/compose/releases/migrate/

Here is a nice summary diagram on the changes from the Docker site:

A diagram from Docker describing what they changed
Docker diagram from https://docs.docker.com/compose/intro/history/

Now, time to update old posts to remove that dash…

Endnotes

1 For more on Docker’s changes, see: https://docs.docker.com/compose/support-and-feedback/faq/

Leave a comment