mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-11 08:27:36 +00:00
abi: fix detection for systemd
create a scope everytime we don't own the current cgroup and we are running on systemd. Closes: https://github.com/containers/podman/issues/6734 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
d3ef4770d4
commit
ce1389bde7
1 changed files with 6 additions and 1 deletions
|
|
@ -70,8 +70,13 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command)
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
initCommand, err := ioutil.ReadFile("/proc/1/comm")
|
||||
// On errors, default to systemd
|
||||
runsUnderSystemd := err != nil || string(initCommand) == "systemd"
|
||||
|
||||
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
|
||||
if conf.Engine.CgroupManager == config.SystemdCgroupsManager {
|
||||
if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {
|
||||
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
|
||||
logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue