mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Suppress "IPv4 forwarding" warning for --net=host
Containers using the host network stack (--net=host) are not affected by "ip-forwarding" being disabled, so there's not need to show a warning. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
af705ca0ae
commit
5fb7f9b29e
2 changed files with 6 additions and 1 deletions
|
@ -488,7 +488,9 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
|
||||||
if hostConfig.OomScoreAdj < -1000 || hostConfig.OomScoreAdj > 1000 {
|
if hostConfig.OomScoreAdj < -1000 || hostConfig.OomScoreAdj > 1000 {
|
||||||
return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000]", hostConfig.OomScoreAdj)
|
return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000]", hostConfig.OomScoreAdj)
|
||||||
}
|
}
|
||||||
if sysInfo.IPv4ForwardingDisabled {
|
|
||||||
|
// ip-forwarding does not affect container with '--net=host'
|
||||||
|
if sysInfo.IPv4ForwardingDisabled && !hostConfig.NetworkMode.IsHost() {
|
||||||
warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.")
|
warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.")
|
||||||
logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
|
logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ or to turn it on manually:
|
||||||
net.ipv4.conf.all.forwarding = 1
|
net.ipv4.conf.all.forwarding = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note**: this setting does not affect containers that use the host
|
||||||
|
> network stack (`--net=host`).
|
||||||
|
|
||||||
Many using Docker will want `ip_forward` to be on, to at least make
|
Many using Docker will want `ip_forward` to be on, to at least make
|
||||||
communication _possible_ between containers and the wider world. May also be
|
communication _possible_ between containers and the wider world. May also be
|
||||||
needed for inter-container communication if you are in a multiple bridge setup.
|
needed for inter-container communication if you are in a multiple bridge setup.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue