MCPcopy Create free account
hub / github.com/containers/common / ListImages

Method ListImages

libimage/runtime.go:541–566  ·  view source on GitHub ↗

ListImages lists images in the local container storage. If names are specified, only images with the specified names are looked up and filtered.

(ctx context.Context, names []string, options *ListImagesOptions)

Source from the content-addressed store, hash-verified

539// ListImages lists images in the local container storage. If names are
540// specified, only images with the specified names are looked up and filtered.
541func (r *Runtime) ListImages(ctx context.Context, names []string, options *ListImagesOptions) ([]*Image, error) {
542 if options == nil {
543 options = &ListImagesOptions{}
544 }
545
546 var images []*Image
547 if len(names) > 0 {
548 for _, name := range names {
549 image, _, err := r.LookupImage(name, nil)
550 if err != nil {
551 return nil, err
552 }
553 images = append(images, image)
554 }
555 } else {
556 storageImages, err := r.store.Images()
557 if err != nil {
558 return nil, err
559 }
560 for i := range storageImages {
561 images = append(images, r.storageToImage(&storageImages[i], nil))
562 }
563 }
564
565 return r.filterImages(ctx, images, options)
566}
567
568// RemoveImagesOptions allow for customizing image removal.
569type RemoveImagesOptions struct {

Callers 9

layerTreeMethod · 0.95
DiskUsageMethod · 0.95
RemoveImagesMethod · 0.95
TestPushFunction · 0.80
TestFilterReferenceFunction · 0.80
TestFilterManifestFunction · 0.80
LookupInstanceMethod · 0.80
TestSaveFunction · 0.80

Calls 3

LookupImageMethod · 0.95
storageToImageMethod · 0.95
filterImagesMethod · 0.95

Tested by 4

TestPushFunction · 0.64
TestFilterReferenceFunction · 0.64
TestFilterManifestFunction · 0.64
TestSaveFunction · 0.64