diff --git a/libcontainer/README.md b/libcontainer/README.md index 901351edb71..89d29b8936c 100644 --- a/libcontainer/README.md +++ b/libcontainer/README.md @@ -50,8 +50,21 @@ 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 []*devices.Rule +var devices []*config.Rule for _, device := range specconv.AllowedDevices { devices = append(devices, &device.Rule) } @@ -80,10 +93,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, },