From 8ae97b2f57a845dd05f70f244a763c53250b4e81 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Wed, 17 Jul 2019 10:49:03 -0400 Subject: 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 --- cmd/podman/imagefilters/filters.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cmd/podman/imagefilters/filters.go') diff --git a/cmd/podman/imagefilters/filters.go b/cmd/podman/imagefilters/filters.go index aa5776599..0b08314ce 100644 --- a/cmd/podman/imagefilters/filters.go +++ b/cmd/podman/imagefilters/filters.go @@ -46,6 +46,16 @@ func DanglingFilter(danglingImages bool) ResultFilter { } } +// ReadOnlyFilter allows you to filter images based on read/only and read/write +func ReadOnlyFilter(readOnly bool) ResultFilter { + return func(i *adapter.ContainerImage) bool { + if readOnly { + return i.IsReadOnly() + } + return !i.IsReadOnly() + } +} + // LabelFilter allows you to filter by images labels key and/or value func LabelFilter(ctx context.Context, labelfilter string) ResultFilter { // We need to handle both label=key and label=key=value -- cgit v1.2.3-54-g00ecf