From b759c1a75e9dcba0c321a9d1c0937c9b155ecf12 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 26 Aug 2022 12:58:22 +0200 Subject: [PATCH] libimage: untag events on image removal As reported in containers/podman/issues/15485, Docker sends untag events prior to removing the image. Follow that example for compatibility reasons. Signed-off-by: Valentin Rothberg --- libimage/image.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libimage/image.go b/libimage/image.go index d1548eb23..3cc843ed3 100644 --- a/libimage/image.go +++ b/libimage/image.go @@ -475,7 +475,11 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma } return processedIDs, err } + report.Untagged = append(report.Untagged, i.Names()...) + for _, name := range i.Names() { + i.runtime.writeEvent(&Event{ID: i.ID(), Name: name, Time: time.Now(), Type: EventTypeImageUntag}) + } if !hasChildren { report.Removed = true