diff options
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/image.go | 2 | ||||
-rw-r--r-- | libpod/image/prune.go | 10 | ||||
-rw-r--r-- | libpod/image/pull.go | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index c8583a1c5..c0baf2e00 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -781,6 +781,7 @@ type History struct { CreatedBy string `json:"createdBy"` Size int64 `json:"size"` Comment string `json:"comment"` + Tags []string `json:"tags"` } // History gets the history of an image and the IDs of images that are part of @@ -847,6 +848,7 @@ func (i *Image) History(ctx context.Context) ([]*History, error) { CreatedBy: oci.History[x].CreatedBy, Size: size, Comment: oci.History[x].Comment, + Tags: layer.Names, }) if layer != nil && layer.Parent != "" && !oci.History[x].EmptyLayer { diff --git a/libpod/image/prune.go b/libpod/image/prune.go index f5be8ed50..3afff22af 100644 --- a/libpod/image/prune.go +++ b/libpod/image/prune.go @@ -116,6 +116,10 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) ( return nil, errors.Wrap(err, "unable to get images to prune") } for _, p := range pruneImages { + repotags, err := p.RepoTags() + if err != nil { + return nil, err + } if err := p.Remove(ctx, true); err != nil { if errors.Cause(err) == storage.ErrImageUsedByContainer { logrus.Warnf("Failed to prune image %s as it is in use: %v", p.ID(), err) @@ -124,7 +128,11 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) ( return nil, errors.Wrap(err, "failed to prune image") } defer p.newImageEvent(events.Prune) - prunedCids = append(prunedCids, p.ID()) + nameOrID := p.ID() + if len(repotags) > 0 { + nameOrID = repotags[0] + } + prunedCids = append(prunedCids, nameOrID) } return prunedCids, nil } diff --git a/libpod/image/pull.go b/libpod/image/pull.go index 326a23f4c..76294ba06 100644 --- a/libpod/image/pull.go +++ b/libpod/image/pull.go @@ -407,5 +407,5 @@ func checkRemoteImageForLabel(ctx context.Context, label string, imageInfo pullR return nil } } - return errors.Errorf("%s has no label %s", imageInfo.image, label) + return errors.Errorf("%s has no label %s in %q", imageInfo.image, label, remoteInspect.Labels) } |