-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Drop "-o com.docker.network.enable_ipv[46]" if overridden #49866
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
Conversation
When a network is created with "-o com.docker.network.enable_ipv4' (including via "default-network-opts" in daemon config), and EnableIPv4 is present in the API request (including when CLI option "--ipv4" is used) - the top-level API value is used and the '-o' is ignored. But, the "-o" still shows up in Options in inspect output, which is confusing if the values are different. So, drop the "-o" if the top-level API option is set. Ditto IPv6. Signed-off-by: Rob Murray <[email protected]>
Thanks! This looks good. Silly question; can we distinguish between "defaults" and "user passed these options?" Thinking out loud: do the Haven't given that a lot of thought, so really just "thinking out loud!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Internally when the network's created, yes - the API field is a pointer, nil if not set, and the After that, if the
Yes, they're just setting the same thing. The label version is needed to allow defaults to be configured, and the API version is needed because labels are terrible UX!
Ok - I'm not quite sure where you're heading ... are you thinking we need to eliminate one or the other, or to be explicit about using defaults? |
Yeah, it's a tricky one; basically, "as a user, where should I look to see what the active configuration is?"
So .. we could almost go the reverse direction and update the labels to match the field (if it was set 😂 ), but likely would end up in more trouble. But I guess this brings us back to the recurring story of "desired" config vs "actual config / state", but also "where did this state come from?";
|
Ah, yes I see. The top level "EnableIPv4"/""EnableIPv6" are the definitive running-state, and labels might go missing, but that's not obvious. The whole label-options mechanism is messy, but there's no straightforward fix. |
- What I did
enable_ipv6
/--ipv6
)enable_ipv4
/--ipv4
)When a network is created with
-o com.docker.network.enable_ipv4
(including viadefault-network-opts
in daemon config), and EnableIPv4 is present in the API request (including when CLI option--ipv4
is used) - the top-level API value is used and the-o
is ignored.But, the
-o
still shows up inOptions
in inspect output, which is confusing if the values are different.Ditto for
enable_ipv6
and option--ipv6
.For example ...
Docker Desktop v4.42 sets these options in
default-network-opts
, see docker/cli#2899 (comment).- How I did it
Drop the "-o" if the corresponding top-level API option is set.
- How to verify it
New integration test.
With the fix, the
Options
value in the example above becomes{}
.- Human readable description for the release notes