Merge pull request #4847 from cpuguy83/devices_by_dir

Support adding devices by dir
This commit is contained in:
Phil Estes
2021-03-17 09:41:02 -04:00
committed by GitHub
8 changed files with 217 additions and 45 deletions

View File

@@ -153,7 +153,7 @@ var (
},
cli.StringSliceFlag{
Name: "device",
Usage: "add a device to a container",
Usage: "file path to a device to add to the container; or a path to a directory tree of devices to add to the container",
},
cli.BoolFlag{
Name: "seccomp",

View File

@@ -264,7 +264,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
opts = append(opts, oci.WithMemoryLimit(limit))
}
for _, dev := range context.StringSlice("device") {
opts = append(opts, oci.WithLinuxDevice(dev, "rwm"))
opts = append(opts, oci.WithDevices(dev, "", "rwm"))
}
}