-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add option --ipv4 #5599
Add option --ipv4 #5599
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5599 +/- ##
==========================================
- Coverage 59.54% 59.51% -0.03%
==========================================
Files 346 346
Lines 29376 29379 +3
==========================================
- Hits 17491 17486 -5
- Misses 10914 10923 +9
+ Partials 971 970 -1 |
Signed-off-by: Rob Murray <[email protected]>
Some apparently-unrelated test failures ...
|
| `com.docker.network.bridge.enable_icc` | `--icc` | Enable or Disable Inter Container Connectivity | | ||
| `com.docker.network.bridge.host_binding_ipv4` | `--ip` | Default IP when binding container ports | | ||
| `com.docker.network.driver.mtu` | `--mtu` | Set the containers network MTU | | ||
| `com.docker.network.container_iface_prefix` | - | Set a custom prefix for container interfaces | | ||
|
||
The following arguments can be passed to `docker network create` for any | ||
network driver, again with their approximate equivalents to Docker daemon | ||
flags used for the docker0 bridge: |
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.
flags used for the docker0 bridge: | |
flags used for the `docker0` bridge: |
(unrelated to this PR)
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.
Done.
| `--gateway` | - | IPv4 or IPv6 Gateway for the master subnet | | ||
| `--ip-range` | `--fixed-cidr`, `--fixed-cidr-v6` | Allocate IPs from a range | | ||
| `--internal` | - | Restrict external access to the network | | ||
| `--ipv6` | `--ipv6` | Enable or disable IPv6 networking | |
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.
Did you remove this line by mistake, or on purpose? The daemon has an --ipv6
flag that controls whether the default bridge is IPv6-capable, so we should keep this line.
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.
Oh, thank you ... by mistake while juggling commits (it came back in the next commit). Should be sorted now.
@@ -73,7 +77,8 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command { | |||
flags.VarP(&options.driverOpts, "opt", "o", "Set driver specific options") | |||
flags.Var(&options.labels, "label", "Set metadata on a network") | |||
flags.BoolVar(&options.internal, "internal", false, "Restrict external access to the network") | |||
flags.BoolVar(&ipv6, "ipv6", false, "Enable or disable IPv6 networking") | |||
flags.BoolVar(&ipv4, "ipv4", true, "Enable or disable IPv4 address assignment") | |||
flags.BoolVar(&ipv6, "ipv6", false, "Enable or disable IPv6 address assignment") |
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.
👍 for the revised help text.
Signed-off-by: Rob Murray <[email protected]>
Signed-off-by: Rob Murray <[email protected]>
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
@@ -73,7 +77,8 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command { | |||
flags.VarP(&options.driverOpts, "opt", "o", "Set driver specific options") | |||
flags.Var(&options.labels, "label", "Set metadata on a network") | |||
flags.BoolVar(&options.internal, "internal", false, "Restrict external access to the network") | |||
flags.BoolVar(&ipv6, "ipv6", false, "Enable or disable IPv6 networking") | |||
flags.BoolVar(&ipv4, "ipv4", true, "Enable or disable IPv4 address assignment") |
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.
flags.BoolVar(&ipv4, "ipv4", true, "Enable or disable IPv4 address assignment") | |
flags.BoolVar(&ipv4, "ipv4", true, "Enable or disable IPv4 address assignment") |
Wondering if we should force this to true
on the CLI side.
The EnableIPv4
is *bool
on the API side, so we could just keep it as missing/null
if user haven't passed this option.
For example if in future we'd need to distinguish between "user explicitly doesn't want ipv4" or "user doesn't care" on the daemon side.
Does that make sense?
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.
LOL, I just wrote a blurb below about "defaults".
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.
so we could just keep it as missing/null if user haven't passed this option
Just above, lines 63-65 (copied from the IPv6 setting), the pointer in the API request is only set if the CLI flag is Changed
... so I think it's ok?
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.
Oh right, I missed that!
Related to this PR: does the compose-spec need an update to allow setting these? I'm not sure if it currently does, and we probably would need to keep parity between compose and docker CLI creating networks. Not for this PR, because it's an existing situation: we need to start thinking of a strategy for defaults. We currently try to reflect defaults on the client side by showing |
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.
changes in this PR LGTM
Yes, we should do ... it's work-around-able in Compose by setting the equivalent driver option, not pretty though. We need to add |
- What I did
Added
network create
option--ipv4
... like--ipv6
, but it defaults totrue
.Updated network create docs to include
--ipv4
- and--fixed-cidr-v6
,--bip6
... and tried to make it more obvious that the short options only affectdocker0
.- How I did it
Mostly by copying code for
--ipv6
.- How to verify it
- Description for the changelog