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>
| ... | ... |
@@ -488,7 +488,9 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. |
| 488 | 488 |
if hostConfig.OomScoreAdj < -1000 || hostConfig.OomScoreAdj > 1000 {
|
| 489 | 489 |
return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000]", hostConfig.OomScoreAdj)
|
| 490 | 490 |
} |
| 491 |
- if sysInfo.IPv4ForwardingDisabled {
|
|
| 491 |
+ |
|
| 492 |
+ // ip-forwarding does not affect container with '--net=host' |
|
| 493 |
+ if sysInfo.IPv4ForwardingDisabled && !hostConfig.NetworkMode.IsHost() {
|
|
| 492 | 494 |
warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.") |
| 493 | 495 |
logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
|
| 494 | 496 |
} |
| ... | ... |
@@ -37,6 +37,9 @@ or to turn it on manually: |
| 37 | 37 |
net.ipv4.conf.all.forwarding = 1 |
| 38 | 38 |
``` |
| 39 | 39 |
|
| 40 |
+> **Note**: this setting does not affect containers that use the host |
|
| 41 |
+> network stack (`--net=host`). |
|
| 42 |
+ |
|
| 40 | 43 |
Many using Docker will want `ip_forward` to be on, to at least make |
| 41 | 44 |
communication _possible_ between containers and the wider world. May also be |
| 42 | 45 |
needed for inter-container communication if you are in a multiple bridge setup. |