Add image_id to json output

Consumers of the json output, like the atomic cli, need the ID of the
image for the container as well as the name.  Specifically, it is used
to tract "used" and "vulnerable" images.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude 2017-08-28 09:59:31 -05:00
parent 2d358fff37
commit 6f492593ec
2 changed files with 4 additions and 0 deletions

View file

@ -53,6 +53,7 @@ type psTemplateParams struct {
type psJSONParams struct {
ID string `json:"id"`
Image string `json:"image"`
ImageID string `json:"image_id"`
Command string `json:"command"`
CreatedAt time.Time `json:"createdAt"`
RunningFor time.Duration `json:"runningFor"`
@ -296,6 +297,7 @@ func getJSONOutput(containers []*libkpod.ContainerData) (psOutput []psJSONParams
params := psJSONParams{
ID: ctr.ID,
Image: ctr.FromImage,
ImageID: ctr.FromImageID,
Command: ctr.ImageCreatedBy,
CreatedAt: ctr.State.Created,
RunningFor: time.Since(ctr.State.Created),

View file

@ -51,6 +51,8 @@ kpod images --format json
kpod images --format "{{.ID}}"
kpod images --filter dangling=true
## SEE ALSO
kpod(1)