|
@@ -90,6 +90,7 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
|
|
|
{"login", "Register or Login to the docker registry server"},
|
|
|
{"logs", "Fetch the logs of a container"},
|
|
|
{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"},
|
|
|
+ {"proc", "Lookup the running processes of a container"},
|
|
|
{"ps", "List containers"},
|
|
|
{"pull", "Pull an image or a repository from the docker registry server"},
|
|
|
{"push", "Push an image or a repository to the docker registry server"},
|
|
@@ -555,6 +556,33 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+func (cli *DockerCli) CmdProc(args ...string) error {
|
|
|
+ cmd := Subcmd("proc", "CONTAINER", "Lookup the running processes of a container")
|
|
|
+ if err := cmd.Parse(args); err != nil {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ if cmd.NArg() != 1 {
|
|
|
+ cmd.Usage()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ body, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/proc", nil)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var procs []APIProc
|
|
|
+ err = json.Unmarshal(body, &procs)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ w := tabwriter.NewWriter(cli.out, 20, 1, 3, ' ', 0)
|
|
|
+ fmt.Fprintln(w, "PID\tTTY\tTIME\tCMD")
|
|
|
+ for _, proc := range procs {
|
|
|
+ fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", proc.PID, proc.Tty, proc.Time, proc.Cmd)
|
|
|
+ }
|
|
|
+ w.Flush()
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func (cli *DockerCli) CmdPort(args ...string) error {
|
|
|
cmd := Subcmd("port", "CONTAINER PRIVATE_PORT", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT")
|
|
|
if err := cmd.Parse(args); err != nil {
|