summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/image.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 197a83dc1..f39b1d78d 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -744,6 +744,20 @@ func (i *Image) Labels(ctx context.Context) (map[string]string, error) {
return imgInspect.Labels, nil
}
+// GetLabel Returns a case-insensitive match of a given label
+func (i *Image) GetLabel(ctx context.Context, label string) (string, error) {
+ imageLabels, err := i.Labels(ctx)
+ if err != nil {
+ return "", err
+ }
+ for k, v := range imageLabels {
+ if strings.ToLower(k) == strings.ToLower(label) {
+ return v, nil
+ }
+ }
+ return "", nil
+}
+
// Annotations returns the annotations of an image
func (i *Image) Annotations(ctx context.Context) (map[string]string, error) {
manifest, manifestType, err := i.Manifest(ctx)