Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockercompose: use "docker compose" before docker-compose #5825

Merged
merged 4 commits into from
May 20, 2022

Conversation

nicksieger
Copy link
Member

No description provided.

@nicksieger nicksieger requested review from nicks and milas May 18, 2022 17:07
@nicksieger nicksieger linked an issue May 18, 2022 that may be closed by this pull request
if err != nil {
composePath = "docker-compose"
return []string{"docker", "compose"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple questions:

  • do we need to worry about docker.exe?
  • the logic here is: "if docker-compose doesn't exist, assume 'docker compose' does." That will lead to this error message:
$ docker compose
docker: 'compose' is not a docker command.
See 'docker --help'

which seems like a bad outcome

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to this doc:
https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command

docker compose is the preferred form, so seems like we should try that first.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I removed the ".exe" appending code because it doesn't seem to be needed anymore (with go 1.18 on windows)
  • Yeah, I think that makes sense. Seems like we might want to just run the version command when we make the client so that we can see which form to use.

I also have some issues with the tests so I'll have another round to look at soon.

Copy link
Member

@nicks nicks May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i might defer to @milas on the logic here, i remember the decision tree being fairly complex

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think docker compose is the recommended way going forward.

It's worth mentioning that the shim actually does some flag translation: https://github.com/docker/compose-switch/blob/2fe0b713c6839e86239e4930b98fe94f3c68f4e2/redirect/convert.go#L26-L64 - I think that --verbose -> --debug might be the only one that would cause trouble, but tbh I'm in favor of not passing that flag at all because Compose emits a LOT of internal debug logging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for decision tree, I think at this point it's safe to prefer docker compose and fallback to docker-compose.

(When V2 was in early preview, we'd prefer docker-compose-v1 which is what the shim would conditionally invoke based on preferences, so we used it explicitly, but that isn't necessary anymore.)

@nicksieger nicksieger changed the title dockercompose: use "docker compose" if docker-compose is not found dockercompose: use "docker compose" before docker-compose May 18, 2022
1. Use program found in $TILT_DOCKER_COMPOSE_CMD
2. Use `docker compose` if `docker compose version` returns successfully
3. Fall back to `docker-compose`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker-compose not found
3 participants