summaryrefslogtreecommitdiff
path: root/pkg/specgenutil/specgen.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgenutil/specgen.go')
-rw-r--r--pkg/specgenutil/specgen.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 8e43cc50e..59ac19c2c 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -8,6 +8,7 @@ import (
"strings"
"time"
+ "github.com/containers/common/pkg/config"
"github.com/containers/image/v5/manifest"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/libpod/define"
@@ -488,8 +489,17 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
if ld := c.LogDriver; len(ld) > 0 {
s.LogConfiguration.Driver = ld
}
- s.CgroupParent = c.CGroupParent
- s.CgroupsMode = c.CGroupsMode
+ s.CgroupParent = c.CgroupParent
+ s.CgroupsMode = c.CgroupsMode
+ if s.CgroupsMode == "" {
+ rtc, err := config.Default()
+ if err != nil {
+ return err
+ }
+
+ s.CgroupsMode = rtc.Cgroups()
+ }
+
s.Groups = c.GroupAdd
s.Hostname = c.Hostname
@@ -587,12 +597,12 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
s.Devices = append(s.Devices, specs.LinuxDevice{Path: dev})
}
- for _, rule := range c.DeviceCGroupRule {
+ for _, rule := range c.DeviceCgroupRule {
dev, err := parseLinuxResourcesDeviceAccess(rule)
if err != nil {
return err
}
- s.DeviceCGroupRule = append(s.DeviceCGroupRule, dev)
+ s.DeviceCgroupRule = append(s.DeviceCgroupRule, dev)
}
s.Init = c.Init