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 Docker Compose V2 #115

Open
sonnguyent2 opened this issue Jan 20, 2024 · 14 comments
Open

Support Docker Compose V2 #115

sonnguyent2 opened this issue Jan 20, 2024 · 14 comments
Assignees
Milestone

Comments

@sonnguyent2
Copy link

sonnguyent2 commented Jan 20, 2024

Currently DockerComposeBuild still use Compose V1 instead of V2. It requires to install docker-compose package. Do you have any plan to migrate to Compose V2?

@MihaMarkic MihaMarkic self-assigned this Feb 8, 2024
@MihaMarkic MihaMarkic added this to the 1.4.0 milestone Feb 8, 2024
@MihaMarkic
Copy link
Owner

Hi @sonnguyent2, I've switched to compose, do you mind give it a try at https://github.com/MihaMarkic/Cake.Docker/tree/feature/compose2 or I could create a prerelease package for you.

@sonnguyent2
Copy link
Author

Hi @MihaMarkic thanks for your response, I have tried to build the code but get this error:
src\Cake.Docker.Tests\Compose\Ps\DockerComposePsTest.cs(13,58): error CS0117: 'DockerComposePsSettings' does not contain a definition for 'Filters'. In the DockerComposePsSettings, there is an Filter property but not Filters , could you please double check ?

@MihaMarkic
Copy link
Owner

@sonnguyent2 I see, fixed. It should compile now.

@sonnguyent2
Copy link
Author

@MihaMarkic yes, its compiled but still got error. Root cause come from the order of command arguments.
This command built by ProcessArgumentBuilder: docker compose build --file docker-compose.yml will not work because --file is not argument of build command, instead it is compose's argument
https://docs.docker.com/engine/reference/commandline/compose/

This command will work: docker compose --file docker-compose.yml build
I managed to make it work by update GenericDockerRunner but it's just a temp solution. For the permanent solution, looking forward to hearing from you.

@MihaMarkic
Copy link
Owner

@sonnguyent2 Hm, good catch, I guess. I have to verify, but I suppose you are correct. Also I wouldn't expect that orders of arguments matter.

@MihaMarkic
Copy link
Owner

@sonnguyent2 Can you try with latest sources? Commit: 0bcf83c

@MihaMarkic
Copy link
Owner

Note: I've separated the two settings into DockerComposeSettings and command specific one.

@silex-victor
Copy link

Hi,

Any news on this ?

According to this issue it seems the standalone docker-compose (aka v1) is being retired from ubuntu runners starting this month and we are already seeing runners without it.

I'd be happy to help.

Best Regards,

@MihaMarkic
Copy link
Owner

@silex-victor I created a commit and asked you to give it a try - see a my answer above...

@silex-victor
Copy link

(Just for the record i was not the original other of this issue)

I'm unable to make it work with the sources from the branch you mentionned and be able to reference the sources / nupkg from our build.cake file, is there documentation somwhere on how to achieve this ?

If it's easy on your side, could you publish a prerelease build from your branch (as mentionned in this comment so I could test it on my side and come back to you ?

Best Regards,

@silex-victor
Copy link

Ok so it seems I was able to make it work referencing the dll itself by using #reference "Dlls/Cake.Docker.dll" (built from the branch feature/compose2) and it seems to be working fine, but I'm unsure of my process.

@MihaMarkic
Copy link
Owner

@silex-victor Will publish a prerelease, sorry for the delay

@MihaMarkic
Copy link
Owner

@silex-victor @sonnguyent2 Released in 1.4.0-beta.1, can you give it a try?

@silex-victor
Copy link

silex-victor commented Nov 4, 2024

Hi,

Sorry for the delay as I have been out of the office for a long time (and thus this account).

I can confirm that the 1.4.0-beta.1 is compiling and working without any change, but I believe something changed regarding nullable annotations as I see these warnings when update the package to target the pre-release version:

(2538,114): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2548,157): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2558,116): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2568,112): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2578,158): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2588,112): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2598,161): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2608,109): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2618,203): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2628,157): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2638,112): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2648,112): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2658,118): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2668,108): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2683,133): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2688,156): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2698,114): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2708,109): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2718,113): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2728,111): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
(2738,108): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

I confirm that they are not present when using version 1.3.0.

I'm available if you need anything else.

Best Regards,

Edit: Formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants