mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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 <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
e306466569
commit
1f7a9b1ab3
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue