From f4e37ab63ece36f61494ef6489230e7f988f9b3a Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Wed, 10 Feb 2016 11:30:06 -0600 Subject: [PATCH] updating usage for runc and runc commands Signed-off-by: Mike Brown --- checkpoint.go | 5 +++++ delete.go | 9 +++++++++ events.go | 5 +++++ exec.go | 9 +++++++++ kill.go | 9 +++++++++ main.go | 14 +++++++++----- pause.go | 14 ++++++++++++++ restore.go | 6 ++++++ spec.go | 6 ++++-- start.go | 9 ++++++++- 10 files changed, 78 insertions(+), 8 deletions(-) diff --git a/checkpoint.go b/checkpoint.go index c1ca44f6..81de35a8 100644 --- a/checkpoint.go +++ b/checkpoint.go @@ -14,6 +14,11 @@ import ( var checkpointCommand = cli.Command{ Name: "checkpoint", Usage: "checkpoint a running container", + ArgsUsage: ` + +Where "" is the name for the instance of the container to be +checkpointed.`, + Description: `The checkpoint command saves the state of the container instance.`, Flags: []cli.Flag{ cli.StringFlag{Name: "image-path", Value: "", Usage: "path for saving criu image files"}, cli.StringFlag{Name: "work-path", Value: "", Usage: "path for saving work files and logs"}, diff --git a/delete.go b/delete.go index 41b37785..4f46564e 100644 --- a/delete.go +++ b/delete.go @@ -5,6 +5,15 @@ import "github.com/codegangsta/cli" var deleteCommand = cli.Command{ Name: "delete", Usage: "delete any resources held by the container often used with detached containers", + ArgsUsage: ` + +Where "" is the name for the instance of the container. + +For example, if the container id is "ubuntu01" and runc list currently shows the +status of "ubuntu01" as "destroyed" the following will delete resources held for +"ubuntu01" removing "ubuntu01" from the runc list of containers: + + # runc delete ubuntu01`, Action: func(context *cli.Context) { container, err := getContainer(context) if err != nil { diff --git a/events.go b/events.go index a4dbaed9..3c3255ea 100644 --- a/events.go +++ b/events.go @@ -23,6 +23,11 @@ type event struct { var eventsCommand = cli.Command{ Name: "events", Usage: "display container events such as OOM notifications, cpu, memory, IO and network stats", + ArgsUsage: ` + +Where "" is the name for the instance of the container.`, + Description: `The events command displays information about the container. By default the +information is displayed once every 5 seconds.`, Flags: []cli.Flag{ cli.DurationFlag{Name: "interval", Value: 5 * time.Second, Usage: "set the stats collection interval"}, cli.BoolFlag{Name: "stats", Usage: "display the container's stats then exit"}, diff --git a/exec.go b/exec.go index 5f7c9e7d..a1da4188 100644 --- a/exec.go +++ b/exec.go @@ -18,6 +18,15 @@ import ( var execCommand = cli.Command{ Name: "exec", Usage: "execute new process inside the container", + ArgsUsage: ` + +Where "" is the name for the instance of the container and +"" is the command to be executed in the container. + +For example, if the container is configured to run the linux ps command the +following will output a list of processes running in the container: + + # runc exec ps`, Flags: []cli.Flag{ cli.StringFlag{ Name: "console", diff --git a/kill.go b/kill.go index 4040b596..3da8aaf6 100644 --- a/kill.go +++ b/kill.go @@ -52,6 +52,15 @@ var signalMap = map[string]syscall.Signal{ var killCommand = cli.Command{ Name: "kill", Usage: "kill sends the specified signal (default: SIGTERM) to the container's init process", + ArgsUsage: ` + +Where "" is the name for the instance of the container and +"" is the signal to be sent to the init process. + +For example, if the container id is "ubuntu01" the following will send a "KILL" +signal to the init process of the "ubuntu01" container: + + # runc kill ubuntu01 KILL`, Action: func(context *cli.Context) { container, err := getContainer(context) if err != nil { diff --git a/main.go b/main.go index f6412f8d..79e31fc0 100644 --- a/main.go +++ b/main.go @@ -23,14 +23,18 @@ container runtime environment for applications. It can be used with your existing process monitoring tools and the container will be spawned as a direct child of the process supervisor. -After creating config files for your root filesystem with runc, you can execute -a container in your shell by running: +Containers are configured using bundles. A bundle for a container is a directory +that includes a specification file named "` + specConfig + `" and a root filesystem. +The root filesystem contains the contents of the container. + +To start a new instance of a container: - # cd /mycontainer # runc start [ -b bundle ] -If not specified, the default value for the 'bundle' is the current directory. -'Bundle' is the directory where '` + specConfig + `' must be located.` +Where "" is your name for the instance of the container that you +are starting. The name you provide for the container instance must be unique on +your host. Providing the bundle directory using "-b" is optional. The default +value for "bundle" is the current directory.` ) func main() { diff --git a/pause.go b/pause.go index 28545c5c..ccec7bbe 100644 --- a/pause.go +++ b/pause.go @@ -7,6 +7,13 @@ import "github.com/codegangsta/cli" var pauseCommand = cli.Command{ Name: "pause", Usage: "pause suspends all processes inside the container", + ArgsUsage: ` + +Where "" is the name for the instance of the container to be +paused. `, + Description: `The pause command suspends all processes in the instance of the container. + +Use runc list to identiy instances of containers and their current status.`, Action: func(context *cli.Context) { container, err := getContainer(context) if err != nil { @@ -21,6 +28,13 @@ var pauseCommand = cli.Command{ var resumeCommand = cli.Command{ Name: "resume", Usage: "resumes all processes that have been previously paused", + ArgsUsage: ` + +Where "" is the name for the instance of the container to be +resumed.`, + Description: `The resume command resumes all processes in the instance of the container. + +Use runc list to identiy instances of containers and their current status.`, Action: func(context *cli.Context) { container, err := getContainer(context) if err != nil { diff --git a/restore.go b/restore.go index 067c13d3..d1da3731 100644 --- a/restore.go +++ b/restore.go @@ -17,6 +17,12 @@ import ( var restoreCommand = cli.Command{ Name: "restore", Usage: "restore a container from a previous checkpoint", + ArgsUsage: ` + +Where "" is the name for the instance of the container to be +restored.`, + Description: `Restores the saved state of the container instance that was previously saved +using the runc checkpoint command.`, Flags: []cli.Flag{ cli.StringFlag{ Name: "image-path", diff --git a/spec.go b/spec.go index 2836e7c8..7b2a7630 100644 --- a/spec.go +++ b/spec.go @@ -23,8 +23,10 @@ import ( ) var specCommand = cli.Command{ - Name: "spec", - Usage: "create a new specification file", + Name: "spec", + Usage: "create a new specification file", + ArgsUsage: "", + Description: `The spec command creates the new specification file named "` + specConfig + `" for the bundle." `, Flags: []cli.Flag{ cli.StringFlag{ Name: "bundle, b", diff --git a/start.go b/start.go index 6d8238e1..901a6616 100644 --- a/start.go +++ b/start.go @@ -17,11 +17,18 @@ import ( var startCommand = cli.Command{ Name: "start", Usage: "create and run a container", + ArgsUsage: ` + +Where "" is your name for the instance of the container that you +are starting. The name you provide for the container instance must be unique on +your host.`, + Description: `The start command creates an instance of a container for a bundle. The bundle +is a directory with a specification file and a root filesystem.`, Flags: []cli.Flag{ cli.StringFlag{ Name: "bundle, b", Value: "", - Usage: "path to the root of the bundle directory", + Usage: `path to the root of the bundle directory, defaults to the current directory`, }, cli.StringFlag{ Name: "console",