BAD_SEED
BAD_SEED

Reputation: 5086

Docker image: virtual size vs real size

This is the output of my docker images command:

$ docker images
REPOSITORY      TAG            IMAGE ID       CREATED         SIZE
redis           3.0.0          6b81c9436dd1   17 months ago   111.1 MB
nginx           1.7            d5acedd7e96a   17 months ago   93.45 MB

Those images share a common layer (debian:jessie, size 85MB), as you can see here. Standing at this output the two images should takes 204.5MB of my disk space, but as fa as I know (due to the shared layer) these images should use only 119.55MB of my disk space (i.e. 204.5MB - 85MB).

Is this assumption right? Why the header "VIRTUAL SIZE" in docker image output has been removed"?

Upvotes: 2

Views: 2932

Answers (1)

Elton Stoneman
Elton Stoneman

Reputation: 19194

Yes, those images do share a common base layer. You can check with docker inspect, which for the latest versions shows they have the same base layer:

> docker inspect -f ' {{ .RootFS }}' redis
{layers [sha256:142a601d97936307e75220c35dde0348971a9584c21e7cb42e1f7004005432ab ...

> docker inspect -f ' {{ .RootFS }}' nginx
{layers [sha256:142a601d97936307e75220c35dde0348971a9584c21e7cb42e1f7004005432ab ...

As to why the label changed - the source code could tell you, but I'd say "virtual image" is not an accurate description. The image size is the image size - it's the space you need if you were to pull the image onto a clean box.

Upvotes: 1

Related Questions