From 9eb31777e3431b6d63b38249ecd62d14ec8ea681 Mon Sep 17 00:00:00 2001 From: xiechengsheng Date: Thu, 26 Apr 2018 13:20:52 +0800 Subject: [PATCH] add default latest tag for rmi --- daemon/mgr/image.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/mgr/image.go b/daemon/mgr/image.go index d27e54ece..0c184094c 100644 --- a/daemon/mgr/image.go +++ b/daemon/mgr/image.go @@ -145,6 +145,10 @@ func (mgr *ImageManager) RemoveImage(ctx context.Context, image *types.ImageInfo } if refTagged, ok := refNamed.(reference.Tagged); ok { ref = refTagged.String() + } else { + // add default tag ":latest" for image which is to be removed + defaultTaggedRef := reference.WithDefaultTagIfMissing(refNamed).(reference.Tagged) + ref = defaultTaggedRef.Name() + ":" + defaultTaggedRef.Tag() } if err := mgr.client.RemoveImage(ctx, ref); err != nil {