Skip to content

docs: update libcontainer README for external cgroups repo#4786

Closed
eyasy1217 wants to merge 2 commits into
opencontainers:mainfrom
eyasy1217:main
Closed

docs: update libcontainer README for external cgroups repo#4786
eyasy1217 wants to merge 2 commits into
opencontainers:mainfrom
eyasy1217:main

Conversation

@eyasy1217

Copy link
Copy Markdown

refs. #4638

Signed-off-by: eyasy1217 <yuyi4145@gmail.com>

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it, maybe you can add the missing "includes" section, which should clarify things.

@eyasy1217

eyasy1217 commented Jun 19, 2025

Copy link
Copy Markdown
Author

While at it, maybe you can add the missing "includes" section, which should clarify things.

Does that mean I should put the import statements inside the Container creation code?

+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 {
	devices = append(devices, &device.Rule)
}

@kolyshkin

Copy link
Copy Markdown
Contributor

Yes, I meant import, not includes :)

Ideally though, these code samples should be placed out of README and into some Go files so that they at least can be test-compiled. Or, README can point out to real code in runc which can also serve as an example.

Signed-off-by: eyasy1217 <yuyi4145@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants