Reputation: 420
I am learning docker by reading docker docs. And for the section about docker rmi
, I found a confusing example:
An image pulled by digest has no tag associated with it:
$ docker images --digests REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf4986bf8c1536 9 weeks ago 2.43 MB
To remove an image using its digest:
$ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125 Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2 Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b
For the above example, why are there multiple Deleted
after docker rmi
? Shouldn't there be only one image being deleted?
Upvotes: 0
Views: 129
Reputation: 32176
Because the command
docker rmi
removes all the layers in each image.
If your image has 23 layers, you will see 23
Deleted
You can see the layers in an image with the command
docker history myimage
See also
Finding the layers and layer sizes for each Docker image
Upvotes: 1