Repository navigation
Conversation
Docker 29 reports addresses which were not set explicitly as empty
strings in a container's per-network IPAMConfig, for example
{"IPv4Address": "", "IPv6Address": ""} for an automatic IP.
docker.compare_container_networks passed them through, so the network
changes which docker_container.running reports contained empty strings.
It also decides whether an IP configuration is static with
bool(IPAMConfig), so an automatic IP counted as a static one. Because
of this, the functional test_running_networks fails on main with
Docker 29.
Drop the empty values when reading the networks, so that an IPAMConfig
without explicitly set addresses counts as no static configuration.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Docker 29 reports addresses which were not set explicitly as empty strings in a container's per-network
IPAMConfig. With Docker 29.1.3:IPAMConfig{"IPv4Address": "", "IPv6Address": ""}{"IPv4Address": "10.247.198.10", "IPv6Address": ""}bridgenulldocker.compare_container_networks, whichdocker_container.runninguses to find network changes, passed these values through. This had two effects:bool(IPAMConfig). A dict of empty strings is truthy, so an automatic IP counted as a static one, and the changes for switching between static and automatic IP configuration, or for connecting a network with an automatic IP, were reported asIPAMConfigvalues made of empty strings instead ofIPConfigurationand the assigned IP.This PR drops the empty values when reading the networks, so that an
IPAMConfigwithout explicitly set addresses counts as no static configuration. It builds new dicts for this instead of changing the inspect data which the caller passed in. The loop over the second container's networks now iterates with.items(), because pylint asked for it once the networks are a plain dict.The same kind of Docker 29 change, an empty
IPRangein network IPAM pools, is already handled bydocker.compare_networks.What issues does this PR fix or reference?
Fixes: no issue was opened for this.
Previous Behavior
With Docker 29, the 5 cases of the functional test
test_running_networksfail on main, for example:New Behavior
The reported changes contain only explicitly set addresses, and an automatic IP is reported as automatic. All cases of
test_running_networkspass with Docker 29.Merge requirements satisfied?
[NOTICE] Bug fixes or new features require tests.
changelog/+container-networks-ipamconfig.fixed.md(I can rename it once it has a number)Commits signed with GPG?
Yes