From 86670cced9bd1f689410b5f35d9abe9c16e79f54 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 26 Jul 2016 00:45:39 -0700 Subject: [PATCH] Fix untag without force while container running With digests being added by default, all images have multiple references. The check for whether force is required to remove the reference should use the new check for single reference which accounts for digest references. This change restores pre-1.12 behavior and ensures images are not accidentally left dangling while a container is running. Signed-off-by: Derek McGowan (github: dmcgowan) (cherry picked from commit 1f7a9b1ab3d261de5be7d490e7e4f978f317242f) Signed-off-by: Tibor Vass --- daemon/image_delete.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/image_delete.go b/daemon/image_delete.go index c1af38bf7f..27286503e5 100644 --- a/daemon/image_delete.go +++ b/daemon/image_delete.go @@ -76,7 +76,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I // first. We can only remove this reference if either force is // true, there are multiple repository references to this // image, or there are no containers using the given reference. - if !(force || len(repoRefs) > 1) { + if !force && isSingleReference(repoRefs) { if container := daemon.getContainerUsingImage(imgID); container != nil { // If we removed the repository reference then // this image would remain "dangling" and since