Skip to content

docs: update libcontainer README for external cgroups repo #4786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eyasy1217
Copy link

refs. #4638

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

@kolyshkin kolyshkin left a comment

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
Copy link
Author

eyasy1217 commented Jun 19, 2025

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
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