If you take another look at the output from previous commands you will spot that the 3 bottom layers of both images have the same UUIDs which means they are shared between those images (and that’s why docker images command reports virtual size of images). This clearly shows that chaining commands allows you to clean up layers before they are committed, but that doesn’t mean you should put everything into a single layer. Out of that you can deduce that image size is the sum of the sizes of the individual layers and that each additional instruction added to your Dockerfile will only ever increase the size of your image.įixing previous Dockerfile is as simple as combining both RUN commands: The AUFS storage driver deletes a file from a layer by placing a whiteout file that effectively obscures the existence of the file in image’s lower, read-only layers. To not go too deep let’s limit ourselves to AUFS storage driver. Now it should be obvious where this Dockerfile fails at optimizing image size.Īnyway let’s take a deeper look so that we understand how are those yum caches removed from image layers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |