Docker Community Forums

Share and learn in the Docker community.

How can I know the total size occupied by an image?

user@localhost:~/docker-pyzmq$ sudo docker images
REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
alpinepyzmq_raw                                          latest              fd24a753f505        2 minutes ago       23.9MB
<none>                                                   <none>              3f763de0fb0b        7 minutes ago       23.9MB
alpinepyzmq_small                                        latest              c7a1f42d0bfd        14 minutes ago      94.8MB
alpinepyzmq                                              latest              5be9ed0fcbcb        17 minutes ago      317MB
<none>                                                   <none>              97aa31fe216a        19 minutes ago      317MB
<none>                                                   <none>              b167c481edc2        22 minutes ago      338MB
<none>                                                   <none>              fe8504847607        29 minutes ago      304MB
<none>                                                   <none>              5b845a00f4d9        32 minutes ago      79.5MB
<none>                                                   <none>              2d6926b0c665        32 minutes ago      79.5MB

Does the output above mean alpinepyzmq_raw can be run inside a computer and it’ll just weight 23.9mb? Or is this size dependent on other layers? If so, how can I figure out the entire image size?

This size is the aggregated sum of all image layers the image consists of.
A created container will use the layers of the image as a read-only base and add a writable layer on top.

Can you be more specific on what you mean by " alpinepyzmq_raw can be run inside a computer and it’ll just weight 23.9mb"?

(Assuming there is no compression)

8 Bits = 1 Byte
Therefore, the size of one pixel is 1 Byte.
Total number of pixels = 800 × 600
Total size: (800 × 600 × 1) Bytes = 480000 Bytes = 48 × 104
Total size of storage: 512 MB = 512 × 106 bytes
Number of images that can be stored = (512 × 106)/(48 × 104) ≈ 1066