executor: mount cgroups in default spec

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-10-02 16:37:28 -07:00
parent c9dc8352a4
commit ec0e352aae
2 changed files with 15 additions and 0 deletions

View File

@ -49,6 +49,14 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou
withROBind(resolvConf, "/etc/resolv.conf"), withROBind(resolvConf, "/etc/resolv.conf"),
withROBind(hostsFile, "/etc/hosts"), withROBind(hostsFile, "/etc/hosts"),
) )
s.Mounts = append(s.Mounts, specs.Mount{
Destination: "/sys/fs/cgroup",
Type: "cgroup",
Source: "cgroup",
Options: []string{"ro", "nosuid", "noexec", "nodev"},
})
// TODO: User // TODO: User
sm := &submounts{} sm := &submounts{}

View File

@ -41,6 +41,7 @@ const (
CapExecMountTmpfs apicaps.CapID = "exec.mount.tmpfs" CapExecMountTmpfs apicaps.CapID = "exec.mount.tmpfs"
CapExecMountSecret apicaps.CapID = "exec.mount.secret" CapExecMountSecret apicaps.CapID = "exec.mount.secret"
CapExecMountSSH apicaps.CapID = "exec.mount.ssh" CapExecMountSSH apicaps.CapID = "exec.mount.ssh"
CapExecCgroupsMounted apicaps.CapID = "exec.cgroup"
CapConstraints apicaps.CapID = "constraints" CapConstraints apicaps.CapID = "constraints"
CapPlatform apicaps.CapID = "platform" CapPlatform apicaps.CapID = "platform"
@ -219,6 +220,12 @@ func init() {
Status: apicaps.CapStatusExperimental, Status: apicaps.CapStatusExperimental,
}) })
Caps.Init(apicaps.Cap{
ID: CapExecCgroupsMounted,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{ Caps.Init(apicaps.Cap{
ID: CapConstraints, ID: CapConstraints,
Enabled: true, Enabled: true,