From 450c8223e69135689ecc5cb052bd7b48953dee98 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Thu, 25 Feb 2016 10:09:22 -0800 Subject: [PATCH] Add pause command to ctr Signed-off-by: Kenfe-Mickael Laventure --- ctr/container.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ctr/container.go b/ctr/container.go index 4e2bf98..70acd0e 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -48,6 +48,7 @@ var containersCommand = cli.Command{ execCommand, killCommand, listCommand, + pauseCommand, startCommand, statsCommand, }, @@ -269,6 +270,26 @@ func attachStdio(s stdio) error { return nil } +var pauseCommand = cli.Command{ + Name: "pause", + Usage: "pause a container", + Action: func(context *cli.Context) { + id := context.Args().First() + if id == "" { + fatal("container id cannot be empty", 1) + } + c := getClient(context) + _, err := c.UpdateContainer(netcontext.Background(), &types.UpdateContainerRequest{ + Id: id, + Pid: "init", + Status: "paused", + }) + if err != nil { + fatal(err.Error(), 1) + } + }, +} + var killCommand = cli.Command{ Name: "kill", Usage: "send a signal to a container or its processes",