ctr: Add sandbox flag to ctr run

Add a flag to be able to run a container in a given sandbox.

Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
Danny Canter
2023-04-18 11:21:31 -07:00
parent 290a800e83
commit 519457e3e0
4 changed files with 13 additions and 0 deletions

View File

@@ -102,6 +102,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
spec containerd.NewContainerOpts
)
if sandbox := context.String("sandbox"); sandbox != "" {
cOpts = append(cOpts, containerd.WithSandbox(sandbox))
}
if config {
cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("label"))))
opts = append(opts, oci.WithSpecFromFile(context.String("config")))