Skip to content

feat : Add support for Docker service networks in ComposeService#683

Merged
gabrieldemarmiesse merged 8 commits intogabrieldemarmiesse:masterfrom
R3gardless:feat/python-on-whales-682
Sep 20, 2025
Merged

feat : Add support for Docker service networks in ComposeService#683
gabrieldemarmiesse merged 8 commits intogabrieldemarmiesse:masterfrom
R3gardless:feat/python-on-whales-682

Conversation

@R3gardless
Copy link
Contributor

@R3gardless R3gardless commented Aug 27, 2025

resolve #682

Hi!

This PR adds support for Docker service networks in Docker Compose.

I implemented ComposeServiceNetwork based on the official documentation.

Additionally, I updated the test cases in complex-compose.yml. (I assumed comlexe-compose.yml was a typo and corrected it—if that’s not the case, please let me know.)

Please let me know if I misunderstood or made any mistakes in the implementation.

Thanks!

…figService

- Introduced ComposeServiceNetwork for enhanced network configuration.
- Updated ComposeConfigService to include networks property for better service management.
- Introduced a new complex-compose.yml file for advanced service and network configurations.
- Updated test cases to validate the new Compose setup and ensure proper functionality.
@gabrieldemarmiesse
Copy link
Owner

Thanks for the PR! From the error message, I guess our version of docker-compose in the ci is not recent enough. Can you try to change the version here: https://github.com/gabrieldemarmiesse/python-on-whales/blob/master/scripts/download-docker-plugins.sh ?

@R3gardless
Copy link
Contributor Author

R3gardless commented Aug 27, 2025

@gabrieldemarmiesse Yes, you're right It seems like some arguments are not supported to current version:

  • gw_priority
  • interface_name
  • driver_opts

Is there any plan to update docker-compose version?

Thanks!

@gabrieldemarmiesse
Copy link
Owner

update the file and then push the change in this pull request. I'm fine with using the latest version :)

…tests

- Updated docker-compose to v2.39.0 and buildx to v0.27.0 in the download script.
- Added assertions for new network configurations in the test for complex compose.
@R3gardless
Copy link
Contributor Author

R3gardless commented Aug 27, 2025

@gabrieldemarmiesse Thank you for the review.

I’ve updated download-docker-plugins.sh to handle updating the versions of docker-compose

- Changed buildx version from 0.27.0 to 0.13.0 for compatibility.
- Ensured the latest version is downloaded for improved functionality.
@R3gardless
Copy link
Contributor Author

R3gardless commented Aug 28, 2025

@gabrieldemarmiesse Hi,

It seems the Docker Engine version also needs to be upgraded to >= 28.1. to support interface_name

Container components_network_service_1  interface_name requires Docker Engine v28.1 or later

@gabrieldemarmiesse
Copy link
Owner

I think we cannot upgrade the engine in github actions, we might have to wait until github upgrade it, or we can try a slighly older version of docker-compose

…tests

- Removed the interface_name field from ComposeServiceNetwork model and updated the complex-compose.yml and test_compose.py accordingly.
- This change simplifies the network configuration and ensures consistency across the codebase. 🚀
…tworks 🛠️

This change cleans up the test by removing the check for the default network, as it's not needed for the current test scenario. 🚀
@R3gardless
Copy link
Contributor Author

R3gardless commented Sep 1, 2025

@gabrieldemarmiesse Thanks, I agree.

I think it would be better to upgrade the Docker Compose version and adjust ComposeServiceNetwork to ensure compatibility with the current test cases and Docker Engine version.

+) Remove interface_name since it is not supported in the current Docker Engine version.

…n complex-compose.yml

- Introduced hostname field to ComposeConfigService for better service identification.
- Updated complex-compose.yml to include hostname for services.
- Enhanced tests to validate hostname configurations. 🚀
@R3gardless
Copy link
Contributor Author

@gabrieldemarmiesse Hi!

All the test cases have passed now. Could you take a look at my PR when you get a chance?

@gabrieldemarmiesse
Copy link
Owner

Thanks, sorry for the delay, everything looks good, but could you revert the uv.lock to its normal state? Thanks!

@R3gardless
Copy link
Contributor Author

@gabrieldemarmiesse Yes, I reverted uv.lock. Thanks!

@R3gardless
Copy link
Contributor Author

@gabrieldemarmiesse Sorry to bother you.
If you get a chance, could you merge this PR?

Thanks!

@gabrieldemarmiesse
Copy link
Owner

Apologies for the delay, it's all good, thanks!

@gabrieldemarmiesse gabrieldemarmiesse merged commit 88eae67 into gabrieldemarmiesse:master Sep 20, 2025
21 checks passed
@R3gardless
Copy link
Contributor Author

@gabrieldemarmiesse Hi!

Thanks for reviewing and merging this PR.

If possible, could you let me know when this feature will be released?

Thanks!

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.

Support Docker-compose service network

2 participants