mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #17589 from giuseppe/add-warning-rootless-system-service-cgroupv1
system: add warning when running rootless on cgroupv1
This commit is contained in:
@ -11,10 +11,12 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/containers/common/pkg/cgroups"
|
||||
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||
api "github.com/containers/podman/v4/pkg/api/server"
|
||||
"github.com/containers/podman/v4/pkg/domain/entities"
|
||||
"github.com/containers/podman/v4/pkg/domain/infra"
|
||||
"github.com/containers/podman/v4/pkg/rootless"
|
||||
"github.com/containers/podman/v4/pkg/servicereaper"
|
||||
"github.com/containers/podman/v4/utils"
|
||||
"github.com/coreos/go-systemd/v22/activation"
|
||||
@ -106,6 +108,11 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
|
||||
// Close the fd right away to not leak it during the entire time of the service.
|
||||
devNullfile.Close()
|
||||
|
||||
cgroupv2, _ := cgroups.IsCgroup2UnifiedMode()
|
||||
if rootless.IsRootless() && !cgroupv2 {
|
||||
logrus.Warnf("Running 'system service' in rootless mode without cgroup v2, containers won't survive a 'system service' restart")
|
||||
}
|
||||
|
||||
if err := utils.MaybeMoveToSubCgroup(); err != nil {
|
||||
// it is a best effort operation, so just print the
|
||||
// error for debugging purposes.
|
||||
|
Reference in New Issue
Block a user