From 461222dba8c2f3410fc702237a8bc7defc091a77 Mon Sep 17 00:00:00 2001 From: Ace-Tang Date: Fri, 23 Nov 2018 15:27:46 +0800 Subject: [PATCH] fix: should get runtime name from container info when use `ctr t checkpoint`, runtime name should get from container info, but not passed by flag, since task has already running with specified runtime Signed-off-by: Ace-Tang --- cmd/ctr/commands/tasks/checkpoint.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/ctr/commands/tasks/checkpoint.go b/cmd/ctr/commands/tasks/checkpoint.go index 52161156f..4d580ef12 100644 --- a/cmd/ctr/commands/tasks/checkpoint.go +++ b/cmd/ctr/commands/tasks/checkpoint.go @@ -18,7 +18,6 @@ package tasks import ( "fmt" - "runtime" "github.com/containerd/containerd" "github.com/containerd/containerd/cmd/ctr/commands" @@ -37,11 +36,6 @@ var checkpointCommand = cli.Command{ Name: "exit", Usage: "stop the container after the checkpoint", }, - cli.StringFlag{ - Name: "runtime", - Usage: "runtime name", - Value: fmt.Sprintf("io.containerd.runtime.v1.%s", runtime.GOOS), - }, }, Action: func(context *cli.Context) error { id := context.Args().First() @@ -61,9 +55,13 @@ var checkpointCommand = cli.Command{ if err != nil { return err } + info, err := container.Info(ctx) + if err != nil { + return err + } var opts []containerd.CheckpointTaskOpts if context.Bool("exit") { - opts = append(opts, withExit(context.String("runtime"))) + opts = append(opts, withExit(info.Runtime.Name)) } checkpoint, err := task.Checkpoint(ctx, opts...) if err != nil {