docker-py
docker-py copied to clipboard
feat: Add gateway_priority support for network endpoints
This pull request introduces support for the gateway_priority parameter, allowing users to specify the gateway selection priority for a container's network endpoint. This feature corresponds to the GwPriority field in the Docker Engine API, available from version 1.48.
Key Changes:
docker.types.networks.EndpointConfig:- Added
gw_priorityparameter to the constructor. - Includes validation for API version (>= 1.48) and integer type.
- Added
docker.api.network.NetworkApiMixin.connect_container_to_network:- Added optional
gw_priorityparameter, which is passed toEndpointConfig.
- Added optional
docker.api.container.ContainerApiMixin.create_endpoint_config:- Added optional
gw_priorityparameter, allowingcreate_containerto utilize this feature vianetworking_config.
- Added optional
- Tests:
- Added new unit tests (
tests/unit/api_network_gw_priority_test.py) forEndpointConfigand theconnect_container_to_networkmethod's handling ofgw_priority. - Updated existing unit tests in
tests/unit/api_network_test.pyandtests/unit/api_container_test.py. - Added new integration tests in
tests/integration/api_network_test.pyandtests/integration/api_container_test.pyto verify functionality against a Docker daemon.
- Added new unit tests (
- Documentation:
- Updated docstrings for all modified methods and classes to include
gw_priority. - Added an entry to
docs/change_log.md.
- Updated docstrings for all modified methods and classes to include
This implementation allows users to influence which network endpoint provides the default gateway for a container, as per the Docker API v1.48 specification.