Hallo, I am building a rootless image using buildah from some base image. The resulting image size as shown by podman images is about 1.3Gb. When I run the image container size reported by podman inspect --size is also approximately the same. podman image tree shows 3 layers for this image and the sum of space, reported for all layers also matches image size. But when I run du -sh / inside the container, the size reported is just about 800Mb. Where the extra 0.5Gb has disappeared? While building the image I delete a lot of files from base image: can it be that even when the files are removed the space, used by them is not actually released? Best regards, -- \ / | | (OvO) | Михаил Иванов | (^^^) | | \^/ | E-mail: ivans@isle.spb.ru | ^ ^ | |
Hi Michael, It's not the issue. When you copy, create, install some files in one layer and delete them in another the files still will be persist in the resulting image but you will not see them the shell. It's applicable not only for buildah. Here is some example dockerfile excerpt: RUN wget http://some_url_with_file -O /your_file RUN rm /your_file Here we create two layers. One downloads a file and another deletes it. Container images layers use OverlayFS to combines multiple different underlying mount points into one. -- Dmitry Misharov Senior Software Quality Engineer Management & Automation QE Red Hat On Friday, 10 September 2021 07:41:37 CEST Michael Ivanov wrote:
Hallo,
I am building a rootless image using buildah from some base image. The resulting image size as shown by podman images is about 1.3Gb. When I run the image container size reported by podman inspect --size is also approximately the same. podman image tree shows 3 layers for this image and the sum of space, reported for all layers also matches image size.
But when I run du -sh / inside the container, the size reported is just about 800Mb. Where the extra 0.5Gb has disappeared?
While building the image I delete a lot of files from base image: can it be that even when the files are removed the space, used by them is not actually released?
Best regards, -- \ / | | (OvO) | Михаил Иванов | (^^^) | | \^/ | E-mail: ivans@isle.spb.ru | ^ ^ | | _______________________________________________ Buildah mailing list -- buildah@lists.buildah.io To unsubscribe send an email to buildah-leave@lists.buildah.io
Hallo, thanks for the reply. So then the files are still occupying the disk space but I do not see them. Is it possible to somehow merge the base image into the one being created instead of keeping base as separate image? Then I guess the deleted files should not take any space? Rgrds, On 10.09.2021 11:43, Dmitry Misharov wrote:
Hi Michael, It's not the issue. When you copy, create, install some files in one layer and delete them in another the files still will be persist in the resulting image but you will not see them the shell. It's applicable not only for buildah. Here is some example dockerfile excerpt:
RUN wget http://some_url_with_file -O /your_file
RUN rm /your_file
Here we create two layers. One downloads a file and another deletes it. Container images layers use OverlayFS to combines multiple different underlying mount points into one.
-- \ / | | (OvO) | Михаил Иванов | (^^^) | | \^/ | E-mail: ivans@isle.spb.ru | ^ ^ | |
Hi Michael, On Fri, Sep 10, 2021 at 11:17 AM Michael Ivanov <ivans@isle.spb.ru> wrote:
Hallo, thanks for the reply.
So then the files are still occupying the disk space but I do not see them. Is it possible to somehow merge the base image into the one being created instead of keeping base as separate image? Then I guess the deleted files should not take any space?
Yes, that is possible via `buildah bud --squash-all`. With --squash-all all layers will be squashed into one single layer. The sibling option --squash will only squash layers created during build but keep the base layers untouched. Kind regards, Valentin
Rgrds,
On 10.09.2021 11:43, Dmitry Misharov wrote:
Hi Michael, It's not the issue. When you copy, create, install some files in one layer and delete them in another the files still will be persist in the resulting image but you will not see them the shell. It's applicable not only for buildah. Here is some example dockerfile excerpt:
RUN wget http://some_url_with_file -O /your_file
RUN rm /your_file
Here we create two layers. One downloads a file and another deletes it. Container images layers use OverlayFS to combines multiple different underlying mount points into one.
-- \ / | | (OvO) | Михаил Иванов | (^^^) | | \^/ | E-mail: ivans@isle.spb.ru | ^ ^ | | _______________________________________________ Buildah mailing list -- buildah@lists.buildah.io To unsubscribe send an email to buildah-leave@lists.buildah.io
Yes, if you want to remove the file completely from the image run the two commands in one go RUN wget http://some_url_with_file -O /your_file && rm /your_file On Fri, Sep 10, 2021 at 2:47 PM Michael Ivanov <ivans@isle.spb.ru> wrote:
Hallo, thanks for the reply.
So then the files are still occupying the disk space but I do not see them. Is it possible to somehow merge the base image into the one being created instead of keeping base as separate image? Then I guess the deleted files should not take any space?
Rgrds,
On 10.09.2021 11:43, Dmitry Misharov wrote:
Hi Michael, It's not the issue. When you copy, create, install some files in one layer and delete them in another the files still will be persist in the resulting image but you will not see them the shell. It's applicable not only for buildah. Here is some example dockerfile excerpt:
RUN wget http://some_url_with_file -O /your_file
RUN rm /your_file
Here we create two layers. One downloads a file and another deletes it. Container images layers use OverlayFS to combines multiple different underlying mount points into one.
-- \ / | | (OvO) | Михаил Иванов | (^^^) | | \^/ | E-mail: ivans@isle.spb.ru | ^ ^ | | _______________________________________________ Buildah mailing list -- buildah@lists.buildah.io To unsubscribe send an email to buildah-leave@lists.buildah.io
participants (4)
-
Dmitry Misharov -
Michael Ivanov -
Osada Paranaliyanage -
Valentin Rothberg