Merge pull request #3424 from crosbymichael/devices

Add linux device options and --devices flag to ctr
This commit is contained in:
Derek McGowan
2019-07-22 16:39:02 -07:00
committed by GitHub
6 changed files with 188 additions and 0 deletions

View File

@@ -126,6 +126,10 @@ var (
Name: "memory-limit",
Usage: "memory limit (in bytes) for the container",
},
cli.StringSliceFlag{
Name: "device",
Usage: "add a device to a container",
},
}
// ImageDecryptionFlags are cli flags needed when decrypting an image
ImageDecryptionFlags = []cli.Flag{

View File

@@ -155,6 +155,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
if limit != 0 {
opts = append(opts, oci.WithMemoryLimit(limit))
}
for _, dev := range context.StringSlice("device") {
opts = append(opts, oci.WithLinuxDevice(dev, "rwm"))
}
}
cOpts = append(cOpts, containerd.WithRuntime(context.String("runtime"), nil))