mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Properly report conflicting namespace options when using userns
This prevents strange errors and clarifies which namespace options are incompatible with user namespaces (at this time). Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
parent
557c7cb888
commit
d5743a3a5c
1 changed files with 17 additions and 2 deletions
|
@ -380,8 +380,23 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
|
|||
warnings = append(warnings, "IPv4 forwarding is disabled. Networking will not work.")
|
||||
logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
|
||||
}
|
||||
if hostConfig.Privileged && daemon.configStore.RemappedRoot != "" {
|
||||
return warnings, fmt.Errorf("Privileged mode is incompatible with user namespace mappings")
|
||||
// check for various conflicting options with user namespaces
|
||||
if daemon.configStore.RemappedRoot != "" {
|
||||
if hostConfig.Privileged {
|
||||
return warnings, fmt.Errorf("Privileged mode is incompatible with user namespaces.")
|
||||
}
|
||||
if hostConfig.NetworkMode.IsHost() || hostConfig.NetworkMode.IsContainer() {
|
||||
return warnings, fmt.Errorf("Cannot share the host or a container's network namespace when user namespaces are enabled.")
|
||||
}
|
||||
if hostConfig.PidMode.IsHost() {
|
||||
return warnings, fmt.Errorf("Cannot share the host PID namespace when user namespaces are enabled.")
|
||||
}
|
||||
if hostConfig.IpcMode.IsContainer() {
|
||||
return warnings, fmt.Errorf("Cannot share a container's IPC namespace when user namespaces are enabled.")
|
||||
}
|
||||
if hostConfig.ReadonlyRootfs {
|
||||
return warnings, fmt.Errorf("Cannot use the --read-only option when user namespaces are enabled.")
|
||||
}
|
||||
}
|
||||
return warnings, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue