From 8d0e8a8abb128b7c7bd13abed01fce21cfc061f1 Mon Sep 17 00:00:00 2001 From: eyasy1217 Date: Thu, 19 Jun 2025 09:06:46 +0900 Subject: [PATCH 1/2] docs: update libcontainer README for external cgroups repo Signed-off-by: eyasy1217 --- libcontainer/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/README.md b/libcontainer/README.md index 901351edb71..5de4433faed 100644 --- a/libcontainer/README.md +++ b/libcontainer/README.md @@ -51,7 +51,7 @@ struct describing how the container is to be created. A sample would look simila ```go defaultMountFlags := unix.MS_NOEXEC | unix.MS_NOSUID | unix.MS_NODEV -var devices []*devices.Rule +var devices []*config.Rule for _, device := range specconv.AllowedDevices { devices = append(devices, &device.Rule) } @@ -80,10 +80,10 @@ config := &configs.Config{ {Type: configs.NEWNET}, {Type: configs.NEWCGROUP}, }), - Cgroups: &configs.Cgroup{ + Cgroups: &cgroups.Cgroup{ Name: "test-container", Parent: "system", - Resources: &configs.Resources{ + Resources: &cgroups.Resources{ MemorySwappiness: nil, Devices: devices, }, From 4f09c7405f4cd855bdec266c9822feda6956cedb Mon Sep 17 00:00:00 2001 From: eyasy1217 Date: Fri, 20 Jun 2025 08:47:23 +0900 Subject: [PATCH 2/2] docs(libcontainer): add import to README example Signed-off-by: eyasy1217 --- libcontainer/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libcontainer/README.md b/libcontainer/README.md index 5de4433faed..89d29b8936c 100644 --- a/libcontainer/README.md +++ b/libcontainer/README.md @@ -50,6 +50,19 @@ To create a container you first have to create a configuration struct describing how the container is to be created. A sample would look similar to this: ```go +import ( + "github.com/opencontainers/cgroups" + _ "github.com/opencontainers/cgroups/devices" + "github.com/opencontainers/cgroups/devices/config" + "github.com/opencontainers/runc/libcontainer/configs" + _ "github.com/opencontainers/runc/libcontainer/nsenter" + "github.com/opencontainers/runc/libcontainer/specconv" + "golang.org/x/sys/unix" + // ... +) + +// ... + defaultMountFlags := unix.MS_NOEXEC | unix.MS_NOSUID | unix.MS_NODEV var devices []*config.Rule for _, device := range specconv.AllowedDevices {