summaryrefslogtreecommitdiff
path: root/libpod/util_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/util_linux.go')
-rw-r--r--libpod/util_linux.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/util_linux.go b/libpod/util_linux.go
index 78cbc75a7..d5c113daf 100644
--- a/libpod/util_linux.go
+++ b/libpod/util_linux.go
@@ -48,6 +48,9 @@ func makeSystemdCgroup(path string) error {
return err
}
+ if rootless.IsRootless() {
+ return controller.CreateSystemdUserUnit(path, rootless.GetRootlessUID())
+ }
return controller.CreateSystemdUnit(path)
}
@@ -57,6 +60,14 @@ func deleteSystemdCgroup(path string) error {
if err != nil {
return err
}
+ if rootless.IsRootless() {
+ conn, err := cgroups.GetUserConnection(rootless.GetRootlessUID())
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+ return controller.DeleteByPathConn(path, conn)
+ }
return controller.DeleteByPath(path)
}