Skip to content

Commit

Permalink
config: default to cgroupns="host" on cgroup v1
Browse files Browse the repository at this point in the history
cgroupns="private" should be used only on cgroup v2.

On cgroup v1 it would be a breaking change, and also we'd need to
check whether the kernel supports cgroup namespaces.

Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Apr 23, 2020
1 parent dc16555 commit d2ea2b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,18 @@ func DefaultConfig() (*Config, error) {
netns = "slirp4netns"
}

cgroupNS := "host"
if cgroup2, _ := cgroupv2.Enabled(); cgroup2 {
cgroupNS = "private"
}

return &Config{
Containers: ContainersConfig{
Devices: []string{},
Volumes: []string{},
Annotations: []string{},
ApparmorProfile: DefaultApparmorProfile,
CgroupNS: "private",
CgroupNS: cgroupNS,
DefaultCapabilities: DefaultCapabilities,
DefaultSysctls: []string{},
DefaultUlimits: getDefaultProcessLimits(),
Expand Down

0 comments on commit d2ea2b9

Please sign in to comment.