Merge pull request #8413 from dcantah/sb_ctr_run
ctr: Add sandbox flag to ctr run
This commit is contained in:
commit
fdd1be6734
@ -141,6 +141,10 @@ var (
|
||||
Usage: "Runtime name or absolute path to runtime binary",
|
||||
Value: defaults.DefaultRuntime,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "sandbox",
|
||||
Usage: "Create the container in the given sandbox",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime-config-path",
|
||||
Usage: "Optional runtime config path",
|
||||
|
@ -164,6 +164,7 @@ var Command = cli.Command{
|
||||
return err
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
container, err := NewContainer(ctx, client, context)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -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")))
|
||||
|
@ -51,6 +51,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
config = context.IsSet("config")
|
||||
)
|
||||
|
||||
if sandbox := context.String("sandbox"); sandbox != "" {
|
||||
cOpts = append(cOpts, containerd.WithSandbox(sandbox))
|
||||
}
|
||||
|
||||
if config {
|
||||
id = context.Args().First()
|
||||
opts = append(opts, oci.WithSpecFromFile(context.String("config")))
|
||||
|
Loading…
Reference in New Issue
Block a user