...
1 package main
2
3 import (
4 "github.com/sirupsen/logrus"
5 "github.com/urfave/cli"
6 )
7
8 var pauseCommand = cli.Command{
9 Name: "pause",
10 Usage: "pause suspends all processes inside the container",
11 ArgsUsage: `<container-id>
12
13 Where "<container-id>" is the name for the instance of the container to be
14 paused. `,
15 Description: `The pause command suspends all processes in the instance of the container.
16
17 Use runc list to identify instances of containers and their current status.`,
18 Action: func(context *cli.Context) error {
19 if err := checkArgs(context, 1, exactArgs); err != nil {
20 return err
21 }
22 rootlessCg, err := shouldUseRootlessCgroupManager(context)
23 if err != nil {
24 return err
25 }
26 if rootlessCg {
27 logrus.Warnf("runc pause may fail if you don't have the full access to cgroups")
28 }
29 container, err := getContainer(context)
30 if err != nil {
31 return err
32 }
33 return container.Pause()
34 },
35 }
36
37 var resumeCommand = cli.Command{
38 Name: "resume",
39 Usage: "resumes all processes that have been previously paused",
40 ArgsUsage: `<container-id>
41
42 Where "<container-id>" is the name for the instance of the container to be
43 resumed.`,
44 Description: `The resume command resumes all processes in the instance of the container.
45
46 Use runc list to identify instances of containers and their current status.`,
47 Action: func(context *cli.Context) error {
48 if err := checkArgs(context, 1, exactArgs); err != nil {
49 return err
50 }
51 rootlessCg, err := shouldUseRootlessCgroupManager(context)
52 if err != nil {
53 return err
54 }
55 if rootlessCg {
56 logrus.Warn("runc resume may fail if you don't have the full access to cgroups")
57 }
58 container, err := getContainer(context)
59 if err != nil {
60 return err
61 }
62 return container.Resume()
63 },
64 }
65
View as plain text