containerd/cmd/ctr/pause.go
Phil Estes 91410874e7
Add pause/unpause implementation
This adds pause and unpause to containerd's execution service and the
same commands to the `ctr` client.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-05-06 16:05:37 -04:00

30 lines
610 B
Go

package main
import (
gocontext "context"
"errors"
"github.com/containerd/containerd/api/services/execution"
"github.com/urfave/cli"
)
var pauseCommand = cli.Command{
Name: "pause",
Usage: "pause an existing container",
ArgsUsage: "CONTAINER",
Action: func(context *cli.Context) error {
containers, err := getExecutionService(context)
if err != nil {
return err
}
id := context.Args().First()
if id == "" {
return errors.New("container id must be provided")
}
_, err = containers.Pause(gocontext.Background(), &execution.PauseRequest{
ID: id,
})
return err
},
}