Cloud and Container Basics
There are five images, each of which stacks its own 30 MB layer on the same base image (120 MB). Layer compression and the size of metadata are ignored. Which of the following is the disk space used by the images when all five are pulled to one server?
- A150 MB
- B270 MB
- C750 MB
Show answer and explanation
Answer: B. 270 MB
Image layers are identified by a digest computed from their contents, and an identical layer is stored only once on a server and shared by several images. The 120 MB base layer is stored once, and the five unique layers take 30 MB × 5 = 150 MB, so the total is 120 + 150 = 270 MB. That is 480 MB less than the 750 MB, (120 + 30) × 5, that would be needed without sharing. Using a common base image reduces pull time and disk usage.
- A. 120 + 30 = 150 MB is the size of a single image. All five unique layers are needed.
- B. Correct. 120 + 30 × 5 = 270 MB.
- C. (120 + 30) × 5 = 750 MB is the value if the base layer were not shared.