ctr: fix label args used in NewContainer

Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
Iceber Gu 2022-05-18 16:11:30 +08:00
parent 42c6be80e3
commit 92b7bc9edc

View File

@ -101,7 +101,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
) )
if config { if config {
cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("labels")))) cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("label"))))
opts = append(opts, oci.WithSpecFromFile(context.String("config"))) opts = append(opts, oci.WithSpecFromFile(context.String("config")))
} else { } else {
var ( var (
@ -122,7 +122,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
return nil, err return nil, err
} }
opts = append(opts, oci.WithRootFSPath(rootfs)) opts = append(opts, oci.WithRootFSPath(rootfs))
cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("labels")))) cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("label"))))
} else { } else {
snapshotter := context.String("snapshotter") snapshotter := context.String("snapshotter")
var image containerd.Image var image containerd.Image