Prune digest references when deleting by tag

When pulling an image with content trust enabled, two references are
created: a digest reference and a tag reference. Deleting by tag
wouldn't actually remove the image, because the digest reference keeps
it alive.

This change modifies the rmi logic so that digest references don't keep
an image alive. If the last tag referencing a given image is deleted,
any digest references to it will be removed as well, so the image can
actually get deleted. This fixes the usability problem with deletions
when content trust is in use, so something like "docker pull busybox;
docker rmi busybox" will work as expected.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
master
Aaron Lehmann 2016-01-06 17:57:21 -08:00 committed by Tibor Vass
parent 66cb79eb98
commit 442cbbfac1
1 changed files with 3 additions and 2 deletions

View File

@ -19,8 +19,9 @@ parent = "smn_cli"
--no-prune Do not delete untagged parents
You can remove an image using its short or long ID, its tag, or its digest. If
an image has one or more tag or digest reference, you must remove all of them
before the image is removed.
an image has one or more tag referencing it, you must remove all of them before
the image is removed. Digest references are removed automatically when an image
is removed by tag.
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE