diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index 12e0019a9b..d1a9f2320b 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -487,10 +487,10 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. if hostConfig.Privileged { return warnings, fmt.Errorf("Privileged mode is incompatible with user namespaces") } - if hostConfig.NetworkMode.IsHost() { + if hostConfig.NetworkMode.IsHost() && !hostConfig.UsernsMode.IsHost() { return warnings, fmt.Errorf("Cannot share the host's network namespace when user namespaces are enabled") } - if hostConfig.PidMode.IsHost() { + if hostConfig.PidMode.IsHost() && !hostConfig.UsernsMode.IsHost() { return warnings, fmt.Errorf("Cannot share the host PID namespace when user namespaces are enabled") } if hostConfig.ReadonlyRootfs {