diff options
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/images.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/abi/images.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/abi/images_list.go | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 69af365c0..74f27e25f 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -218,6 +218,7 @@ type ImageSearchReport struct { Automated string } +// Image List Options type ImageListOptions struct { All bool `json:"all" schema:"all"` Filter []string `json:"Filter,omitempty"` diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 9d6be1b15..be788b2bf 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -469,6 +469,8 @@ func (ir *ImageEngine) Remove(ctx context.Context, images []string, opts entitie switch errors.Cause(err) { case nil: break + case define.ErrNoSuchImage: + inUseErrors = true // ExitCode is expected case storage.ErrImageUsedByContainer: inUseErrors = true // Important for exit codes in Podman. return errors.New( @@ -540,7 +542,7 @@ func (ir *ImageEngine) Remove(ctx context.Context, images []string, opts entitie noSuchImageErrors = true // Important for exit codes in Podman. fallthrough default: - deleteError = multierror.Append(deleteError, err) + deleteError = multierror.Append(deleteError, errors.Wrapf(err, "failed to remove image '%s'", id)) continue } diff --git a/pkg/domain/infra/abi/images_list.go b/pkg/domain/infra/abi/images_list.go index 9add915ea..c559e250c 100644 --- a/pkg/domain/infra/abi/images_list.go +++ b/pkg/domain/infra/abi/images_list.go @@ -25,8 +25,8 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) return nil, err } - summaries := make([]*entities.ImageSummary, len(images)) - for i, img := range images { + var summaries []*entities.ImageSummary + for _, img := range images { var repoTags []string if opts.All { pairs, err := libpodImage.ReposToMap(img.Names()) @@ -41,6 +41,9 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) } } else { repoTags, _ = img.RepoTags() + if len(repoTags) == 0 { + continue + } } digests := make([]string, len(img.Digests())) @@ -72,7 +75,7 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) sz, _ := img.Size(context.TODO()) e.Size = int64(*sz) - summaries[i] = &e + summaries = append(summaries, &e) } return summaries, nil } |