From 4603b6d6b6b00bb635a03ffcb693cde32b3f5c7d Mon Sep 17 00:00:00 2001 From: Laura Brehm Date: Wed, 10 May 2023 01:33:15 +0100 Subject: [PATCH] c8d: fix image history for dangling images Signed-off-by: Laura Brehm --- daemon/containerd/image_history.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/daemon/containerd/image_history.go b/daemon/containerd/image_history.go index a99716ead7..a2d0c11425 100644 --- a/daemon/containerd/image_history.go +++ b/daemon/containerd/image_history.go @@ -90,13 +90,16 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*imaget return nil, err } - tags := make([]string, len(tagged)) - for i, t := range tagged { + var tags []string + for _, t := range tagged { + if isDanglingImage(t) { + continue + } name, err := reference.ParseNamed(t.Name) if err != nil { return nil, err } - tags[i] = reference.FamiliarString(name) + tags = append(tags, reference.FamiliarString(name)) } history[0].Tags = tags }