Merge pull request #3297 from kolyshkin/1.0-3226

[1.0] Remove sub cgroup when container exits
This commit is contained in:
Kir Kolyshkin
2021-11-30 16:57:13 -08:00
committed by GitHub
+4 -4
View File
@@ -5,7 +5,6 @@ package systemd
import (
"fmt"
"math"
"os"
"path/filepath"
"strconv"
"strings"
@@ -307,9 +306,10 @@ func (m *unifiedManager) Destroy() error {
return err
}
// XXX this is probably not needed, systemd should handle it
err := os.Remove(m.path)
if err != nil && !os.IsNotExist(err) {
// systemd 239 do not remove sub-cgroups.
err := cgroups.RemovePath(m.path)
// cgroups.RemovePath has handled ErrNotExist
if err != nil {
return err
}