mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39578 from rgulewich/cgroupns-test-req
Fix running in privileged mode against a daemon with --default-cgroupns-mode=host
This commit is contained in:
commit
cd1356d9ea
2 changed files with 9 additions and 5 deletions
|
@ -361,11 +361,15 @@ func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConf
|
|||
|
||||
// Set default cgroup namespace mode, if unset for container
|
||||
if hostConfig.CgroupnsMode.IsEmpty() {
|
||||
m := config.DefaultCgroupNamespaceMode
|
||||
if daemon.configStore != nil {
|
||||
m = daemon.configStore.CgroupNamespaceMode
|
||||
if hostConfig.Privileged {
|
||||
hostConfig.CgroupnsMode = containertypes.CgroupnsMode("host")
|
||||
} else {
|
||||
m := config.DefaultCgroupNamespaceMode
|
||||
if daemon.configStore != nil {
|
||||
m = daemon.configStore.CgroupNamespaceMode
|
||||
}
|
||||
hostConfig.CgroupnsMode = containertypes.CgroupnsMode(m)
|
||||
}
|
||||
hostConfig.CgroupnsMode = containertypes.CgroupnsMode(m)
|
||||
}
|
||||
|
||||
adaptSharedNamespaceContainer(daemon, hostConfig)
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestCgroupNamespacesRun(t *testing.T) {
|
|||
func TestCgroupNamespacesRunPrivileged(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
|
||||
skip.If(t, testEnv.IsRemoteDaemon())
|
||||
skip.If(t, requirement.CgroupNamespacesEnabled())
|
||||
skip.If(t, !requirement.CgroupNamespacesEnabled())
|
||||
|
||||
// When the daemon defaults to private cgroup namespaces, privileged containers
|
||||
// launched should not be inside their own cgroup namespaces
|
||||
|
|
Loading…
Add table
Reference in a new issue