In the first example, all these images differ only in the smaller layer (the 20 MB one), and share the lager (980 MB) one. But what happens if there are 10 similar images – images from the same repo with different tags? Well, it depends… If our image is the only one using these two layers, then yes, that image occupies 1 GB of disk space. They’ve been chosen to make the point obvious. The number of images and their sizes are not representative. In both of them, we’ll observe a 1 GB image with 2 layers, one taking 20 MB, and the other one 980 MB. In all other cases, the math is not that simple. However, this is an extremely uncommon situation. If all layers in an image are used only in that image, then yes, image size represents the amount of disk space occupied by that image. Because of such architecture, image size and disk consumption are not necessarily directly correlated. different images might share some layers. Smaller Docker images take up less disk spaceĪ Docker image is composed of reusable layers, i.e. But in this article, I want to address the urban legends mentioned above. There are some other legitimate reasons why it’s desirable to have smaller Docker images, like reducing the attack surface. It takes a long time.Īlthough both these statements sound like they make sense, neither is generally true. I’ve heard the following two answers too often for my liking: The logical question that follows is “why?”. Does Docker image size matter? The answer I usually hear is “yes”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |