containerd/cmd/ctr/inspect.go
Kenfe-Mickael Laventure 6f9eda1134 api/execution: remove ProcessID from rpc calls
Now that the shim handles all container's processes the system pid is
sufficient.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-02-02 15:36:10 -08:00

42 lines
1 KiB
Go

package main
import (
gocontext "context"
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/docker/containerd/api/execution"
"github.com/urfave/cli"
)
var inspectCommand = cli.Command{
Name: "inspect",
Usage: "inspect a container",
ArgsUsage: "CONTAINER",
Action: func(context *cli.Context) error {
executionService, err := getExecutionService(context)
if err != nil {
return err
}
id := context.Args().First()
if id == "" {
return fmt.Errorf("container id must be provided")
}
getResponse, err := executionService.GetContainer(gocontext.Background(),
&execution.GetContainerRequest{ID: id})
if err != nil {
return err
}
listProcResponse, err := executionService.ListProcesses(gocontext.Background(),
&execution.ListProcessesRequest{ContainerID: id})
if err != nil {
return err
}
dumper := spew.NewDefaultConfig()
dumper.Indent = "\t"
dumper.DisableMethods = true
dumper.DisablePointerAddresses = true
dumper.Dump(getResponse, listProcResponse)
return nil
},
}