Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions libcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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,
},
Expand Down