feat: Add gateway_priority support for network endpoints #3339
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theGwPriority
field in the Docker Engine API, available from version 1.48.Key Changes:
docker.types.networks.EndpointConfig
:gw_priority
parameter to the constructor.docker.api.network.NetworkApiMixin.connect_container_to_network
:gw_priority
parameter, which is passed toEndpointConfig
.docker.api.container.ContainerApiMixin.create_endpoint_config
:gw_priority
parameter, allowingcreate_container
to utilize this feature vianetworking_config
.tests/unit/api_network_gw_priority_test.py
) forEndpointConfig
and theconnect_container_to_network
method's handling ofgw_priority
.tests/unit/api_network_test.py
andtests/unit/api_container_test.py
.tests/integration/api_network_test.py
andtests/integration/api_container_test.py
to verify functionality against a Docker daemon.gw_priority
.docs/change_log.md
.This implementation allows users to influence which network endpoint provides the default gateway for a container, as per the Docker API v1.48 specification.