summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-08-14 11:21:26 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-08-14 15:46:07 +0200
commit9873901469bd5a4e435132cbb65aa6bacf798c2a (patch)
tree1280b3cef25bdeb04f5d54bea2a5e38695074e49 /libpod
parenta734b53357a84d5156e2902113e72d9384f9515b (diff)
downloadpodman-9873901469bd5a4e435132cbb65aa6bacf798c2a.tar.gz
podman-9873901469bd5a4e435132cbb65aa6bacf798c2a.tar.bz2
podman-9873901469bd5a4e435132cbb65aa6bacf798c2a.zip
pkg/cgroups: use DBUS session when rootless
use the DBUS user session when running in rootless mode. Closes: https://github.com/containers/libpod/issues/3801 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod')
-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)
}