Skip to content

Commit

Permalink
Merge pull request #369 from yanxuean/show-pod-in-ps
Browse files Browse the repository at this point in the history
support to show podid in crictl ps
  • Loading branch information
Random-Liu authored Aug 14, 2018
2 parents 9d4dd73 + 2245fd3 commit b02d752
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {

w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0)
if !opts.verbose && !opts.quiet {
fmt.Fprintln(w, "CONTAINER ID\tIMAGE\tCREATED\tSTATE\tNAME\tATTEMPT")
fmt.Fprintln(w, "CONTAINER ID\tIMAGE\tCREATED\tSTATE\tNAME\tATTEMPT\tPOD ID")
}
for _, c := range r.Containers {
if opts.quiet {
Expand All @@ -635,8 +635,9 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
image = getTruncatedID(digest.String(), string(digest.Algorithm())+":")
}
}
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\n",
id, image, ctm, convertContainerState(c.State), c.Metadata.Name, c.Metadata.Attempt)
PodID := getTruncatedID(c.PodSandboxId, "")
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\t%s\n",
id, image, ctm, convertContainerState(c.State), c.Metadata.Name, c.Metadata.Attempt, PodID)
continue
}

Expand Down

0 comments on commit b02d752

Please sign in to comment.