summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/run.go8
-rw-r--r--libpod/options.go3
2 files changed, 8 insertions, 3 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index ca66aadf2..32b3b9bdc 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -72,7 +72,13 @@ func runCmd(c *cli.Context) error {
options = append(options, libpod.WithUser(createConfig.User))
options = append(options, libpod.WithShmDir(createConfig.ShmDir))
options = append(options, libpod.WithShmSize(createConfig.Resources.ShmSize))
- options = append(options, libpod.WithCgroupParent(createConfig.CgroupParent))
+
+ // Default used if not overridden on command line
+
+ if createConfig.CgroupParent != "" {
+ options = append(options, libpod.WithCgroupParent(createConfig.CgroupParent))
+ }
+
ctr, err := runtime.NewContainer(runtimeSpec, options...)
if err != nil {
return err
diff --git a/libpod/options.go b/libpod/options.go
index 6d3091378..56e8fa203 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -656,7 +656,6 @@ func WithLogPath(path string) CtrCreateOption {
}
// WithCgroupParent sets the Cgroup Parent of the new container
-// Default used if not overridden on command line
func WithCgroupParent(parent string) CtrCreateOption {
return func(ctr *Container) error {
if ctr.valid {
@@ -664,7 +663,7 @@ func WithCgroupParent(parent string) CtrCreateOption {
}
if parent == "" {
- return nil
+ return errors.Wrapf(ErrInvalidArg, "cgroup parent cannot be empty")
}
ctr.config.CgroupParent = parent