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

Support for docker compose v2.0.0 incl. using dock binary instead of docker-compose #221

Closed
Ross-Duckworth-Pharos opened this issue Oct 6, 2021 · 7 comments
Assignees
Labels
enhancement under-development Denotes that a issue is under development but not yet released.
Milestone

Comments

@Ross-Duckworth-Pharos
Copy link

The recently released Docker Compose V2 (https://github.com/docker/compose/releases/tag/v2.0.0) introduces the following change: container names use hyphens to produce a valid hostname

This breaks the container name parsing in ExtractName in Ductus.FluentDocker/Services/Impl/DockerComposeCompositeService.cs which assumes underscores are being used (now hyphens are).

@mariotoffia mariotoffia self-assigned this Oct 6, 2021
@mariotoffia mariotoffia added enhancement under-investigation A investigation is made around the issue labels Oct 6, 2021
@mariotoffia mariotoffia added this to the 3.0.0-RELEASE milestone Oct 6, 2021
@mariotoffia
Copy link
Owner

Hi @Ross-Duckworth-Pharos and thanks for reporting this!

I will add the possibility to AssumeComposeVersion / AutoDetect so it could use different strategies depending on version.

(another task is actually to allow for docker compose command as well.

Cheers,
Mario :)

@mariotoffia mariotoffia changed the title Docker Compose V2 breaks FluentDocker due to generated container name format change Support for docker compose v2.0.0 incl. using dock binary instead of docker-compose Oct 8, 2021
@mariotoffia mariotoffia added under-development Denotes that a issue is under development but not yet released. and removed under-investigation A investigation is made around the issue labels Oct 15, 2021
@psavva
Copy link

psavva commented Nov 6, 2022

Docker-Compose v1 has been deprecated, and we should all switch to docker compose v2

Any ideas as to when this can be supported?

@psavva
Copy link

psavva commented Nov 6, 2022

As a potential quick fix:
alias docker-compose="docker compose"

edit: Ductus.FluentDocker.Common.FluentDockerException: Could not resolve binary docker-compose is it installed on the local system?
I'm not able to get FluentDocker to work with the alias....

@adamf-datapath
Copy link
Contributor

Docker-Compose v1 has been deprecated, and we should all switch to docker compose v2

Any ideas as to when this can be supported?

Docker provide Compose Switch, which translates calls made to the old V1 docker-compose command to the new V2 docker compose - however, the container name parsing is still broken due to the issue mentioned in the original post.

This PR allows the compose version to be specified to ensure the correct parsing logic is used, which combined with Compose Switch means FluentDocker is able to work with the latest Compose version.

@jchannon
Copy link

Just hit this same issue, is there a path forward

@mariotoffia
Copy link
Owner

There's a setting so you can specify the compose version ComposeVersion.V2. For example in the fluent API:

AssumeComposeVersion(ComposeVersion.V2)

Default is Unknown and hence falls back to V1 behavoiur. This behaviour will be deprecated and migrated to default as V2 this year.

Cheers,
Mario :)

@cvicenti-apr
Copy link

This does not seem to work when passing a docker-compose.yml file through DockerComposeCompositeService.
I'm using the following:

new DockerComposeCompositeService(
                DockerHost,
                new DockerComposeConfig
                {
                    ComposeFilePath = [filePath],
                    ForceRecreate = true,
                    RemoveOrphans = true,
                    StopOnDispose = true,
                    ComposeVersion = ComposeVersion.V2,
                    TimeoutSeconds = TimeSpan.FromSeconds(300)
                });

But it's still using V1 unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement under-development Denotes that a issue is under development but not yet released.
Projects
None yet
Development

No branches or pull requests

6 participants