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>
Upstream-commit: 2f048f73e122ab90b8f35a088b4be52bd255caad
Component: engine
This commit is contained in:
Aaron Lehmann
2016-01-06 17:57:21 -08:00
parent 371d581281
commit eb73b224c4
4 changed files with 113 additions and 4 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