浏览代码

Allow using --pid=host and --net=host when --userns=host

It is safe to set other namespaces to host when user ns is set to host

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Mrunal Patel 9 年之前
父节点
当前提交
3c3d2bf852
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      daemon/daemon_unix.go

+ 2 - 2
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 {