Prefer `docker compose` over `docker-compose` in development environment
Proposed Changes
- Change
tasks.pyto default todocker composerather thandocker-compose - Provide a config option in
tasks.py/invoke.ymlthat can be set to preferdocker-composeif desired. - Update documentation accordingly to reflect both of the above.
Justification
In environments where Docker Desktop is installed, docker compose is the v2 replacement for v1 docker-compose. There is presently a toggle that can be set in the Docker Desktop preferences to turn docker-compose into an alias for docker compose. I have confirmed that our development environment works with both v2 and reasonably recent versions of docker-compose v1, but it is known to not work with older versions of docker-compose v1 (see for example #1897)
However, it's also possible to install docker compose as a standalone binary (without installing the rest of Docker), in which case the binary will be docker-compose. Some users follow this pattern where they are actually running Docker itself on a remote system and only using docker-compose locally to manage the remote system, hence the need to provide a config option.
References:
- https://www.docker.com/blog/announcing-compose-v2-general-availability/
- https://docs.docker.com/compose/install/compose-plugin/#install-the-plugin-manually