diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-08-07 04:50:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 04:50:13 +0200 |
commit | 66ea32cbaf926d59fae3345b7e27a15050ab3afe (patch) | |
tree | 06ec77f93d25961863f89be8b4b5af0172e8b827 /libpod | |
parent | f0a5b7ff9944f3666c9d28e1a20f9688307fe93b (diff) | |
parent | 69727abdf6e7583fc5018dc9a724c6e10bfb4e8f (diff) | |
download | podman-66ea32cbaf926d59fae3345b7e27a15050ab3afe.tar.gz podman-66ea32cbaf926d59fae3345b7e27a15050ab3afe.tar.bz2 podman-66ea32cbaf926d59fae3345b7e27a15050ab3afe.zip |
Merge pull request #3731 from giuseppe/fix-systemd-in-a-container
cgroup: fix regression when running systemd
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 047b73d65..5aa4ee9a9 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -471,9 +471,9 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro return err } - g.RemoveMount("/sys/fs/cgroup") - if unified { + g.RemoveMount("/sys/fs/cgroup") + sourcePath := filepath.Join("/sys/fs/cgroup") systemdMnt := spec.Mount{ Destination: "/sys/fs/cgroup", @@ -483,31 +483,13 @@ func (c *Container) setupSystemd(mounts []spec.Mount, g generate.Generator) erro } g.AddMount(systemdMnt) } else { - // rootless containers have no write access to /sys/fs/cgroup, so don't - // add any mount into the container. - if !rootless.IsRootless() { - cgroupPath, err := c.CGroupPath() - if err != nil { - return err - } - sourcePath := filepath.Join("/sys/fs/cgroup", cgroupPath) - - systemdMnt := spec.Mount{ - Destination: "/sys/fs/cgroup", - Type: "bind", - Source: sourcePath, - Options: []string{"bind", "private"}, - } - g.AddMount(systemdMnt) - } else { - systemdMnt := spec.Mount{ - Destination: "/sys/fs/cgroup", - Type: "bind", - Source: "/sys/fs/cgroup", - Options: []string{"bind", "nodev", "noexec", "nosuid"}, - } - g.AddMount(systemdMnt) + systemdMnt := spec.Mount{ + Destination: "/sys/fs/cgroup/systemd", + Type: "bind", + Source: "/sys/fs/cgroup/systemd", + Options: []string{"bind", "nodev", "noexec", "nosuid"}, } + g.AddMount(systemdMnt) } return nil |