Browse code

Suppress "IPv4 forwarding" warning for --net=none

There's no need to warn that "ip-forwarding" is disabled
if a container doesn't use networking.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/05/21 00:39:05
Showing 1 changed files
... ...
@@ -489,8 +489,8 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
489 489
 		return warnings, fmt.Errorf("Invalid value %d, range for oom score adj is [-1000, 1000]", hostConfig.OomScoreAdj)
490 490
 	}
491 491
 
492
-	// ip-forwarding does not affect container with '--net=host'
493
-	if sysInfo.IPv4ForwardingDisabled && !hostConfig.NetworkMode.IsHost() {
492
+	// ip-forwarding does not affect container with '--net=host' (or '--net=none')
493
+	if sysInfo.IPv4ForwardingDisabled && !(hostConfig.NetworkMode.IsHost() || hostConfig.NetworkMode.IsNone()) {
494 494
 		warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.")
495 495
 		logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
496 496
 	}