diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-07-17 10:49:03 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-07-19 06:59:49 -0400 |
commit | 8ae97b2f57a845dd05f70f244a763c53250b4e81 (patch) | |
tree | 002608749a0930e7a75a6213217a9f09461eec71 /pkg/adapter/runtime.go | |
parent | 398aeac8537e82ca813bb77e44ddfcefa5cc5ad5 (diff) | |
download | podman-8ae97b2f57a845dd05f70f244a763c53250b4e81.tar.gz podman-8ae97b2f57a845dd05f70f244a763c53250b4e81.tar.bz2 podman-8ae97b2f57a845dd05f70f244a763c53250b4e81.zip |
Add support for listing read/only and read/write images
When removing --all images prune images only attempt to remove read/write images,
ignore read/only images
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/adapter/runtime.go')
-rw-r--r-- | pkg/adapter/runtime.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg/adapter/runtime.go b/pkg/adapter/runtime.go index e65f07898..dc193c738 100644 --- a/pkg/adapter/runtime.go +++ b/pkg/adapter/runtime.go @@ -85,16 +85,27 @@ func getRuntime(runtime *libpod.Runtime) (*LocalRuntime, error) { // GetImages returns a slice of images in containerimages func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) { + return r.getImages(false) +} + +// GetRWImages returns a slice of read/write images in containerimages +func (r *LocalRuntime) GetRWImages() ([]*ContainerImage, error) { + return r.getImages(true) +} + +func (r *LocalRuntime) getImages(rwOnly bool) ([]*ContainerImage, error) { var containerImages []*ContainerImage images, err := r.Runtime.ImageRuntime().GetImages() if err != nil { return nil, err } for _, i := range images { + if rwOnly && i.IsReadOnly() { + continue + } containerImages = append(containerImages, &ContainerImage{i}) } return containerImages, nil - } // NewImageFromLocal returns a containerimage representation of a image from local storage |