From b8dc9a889f3d945bcd0f02f8ca34eb2e579e8b0e Mon Sep 17 00:00:00 2001 From: Konstantin Baranov Date: Tue, 15 Sep 2020 20:50:07 -0700 Subject: Use container ID as cgroup name if not provided Useful when you want to run multiple containers with the same config. And runc does that too. --- runsc/container/container.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runsc/container') diff --git a/runsc/container/container.go b/runsc/container/container.go index 7ad09bf23..15c445754 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -311,6 +311,10 @@ func New(conf *boot.Config, args Args) (*Container, error) { if isRoot(args.Spec) { log.Debugf("Creating new sandbox for container %q", args.ID) + if args.Spec.Linux != nil && args.Spec.Linux.CgroupsPath == "" { + args.Spec.Linux.CgroupsPath = "/" + args.ID + } + // Create and join cgroup before processes are created to ensure they are // part of the cgroup from the start (and all their children processes). cg, err := cgroup.New(args.Spec) -- cgit v1.2.3