mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/sysinfo: use containerd/sys to detect UserNamespaces
The implementation in libcontainer/system is quite complicated, and we only use it to detect if user-namespaces are enabled. In addition, the implementation in containerd uses a sync.Once, so that detection (and reading/parsing `/proc/self/uid_map`) is only performed once. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
9ff990a2b9
commit
66bb1c4644
1 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
|
||||
cgroupsV2 "github.com/containerd/cgroups/v2"
|
||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/containerd/containerd/sys"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -146,6 +146,6 @@ func applyPIDSCgroupInfoV2(info *SysInfo, controllers map[string]struct{}, _ str
|
|||
}
|
||||
|
||||
func applyDevicesCgroupInfoV2(info *SysInfo, controllers map[string]struct{}, _ string) []string {
|
||||
info.CgroupDevicesEnabled = !rsystem.RunningInUserNS()
|
||||
info.CgroupDevicesEnabled = !sys.RunningInUserNS()
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue