summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 0b5a8b946..6bf8439da 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -14,6 +14,7 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
+ "github.com/containers/libpod/pkg/cgroups"
"github.com/containers/libpod/pkg/ctime"
"github.com/containers/libpod/pkg/hooks"
"github.com/containers/libpod/pkg/hooks/exec"
@@ -1132,6 +1133,16 @@ func (c *Container) pause() error {
return errors.Wrapf(define.ErrNoCgroups, "cannot pause without using CGroups")
}
+ if rootless.IsRootless() {
+ cgroupv2, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ return errors.Wrap(err, "failed to determine cgroupversion")
+ }
+ if !cgroupv2 {
+ return errors.Wrap(define.ErrNoCgroups, "can not pause containers on rootless containers with cgroup V1")
+ }
+ }
+
if err := c.ociRuntime.pauseContainer(c); err != nil {
return err
}