Skip to content

Conversation

eyasy1217
Copy link

refs. #4638

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.

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