nautobot icon indicating copy to clipboard operation
nautobot copied to clipboard

Prefer `docker compose` over `docker-compose` in development environment

Open glennmatthews opened this issue 3 years ago • 0 comments

Proposed Changes

  • Change tasks.py to default to docker compose rather than docker-compose
  • Provide a config option in tasks.py/invoke.yml that can be set to prefer docker-compose if 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

glennmatthews avatar Aug 15 '22 15:08 glennmatthews