Closed debarshiray closed 10 months ago
Just a note - with Ubuntu images I've made sure not to blow up layers in size - so all size-sensitive operations are done in a single command.
I wonder if we should use --squash
or --squash-all
(I believe only the latter will provide additional size benefits).
Some historical context: https://src.fedoraproject.org/container/fedora-toolbox/pull-request/4#comment-132348
Just a note - with Ubuntu images I've made sure not to blow up layers in size - so all size-sensitive operations are done in a single command.
Cool!
I wonder if we should use
--squash
or--squash-all
(I believe only the latter will provide additional size benefits).
The Fedora build system uses Docker to build images, while I have always used podman build
myself. So, I am not sure if what Fedora is doing is equivalent to --squash
or --squash-all
. However, the podman-build(1)
manual suggests that it's --squash
.
I am no expert in Container/Dockerfiles, but I have observed that it's considered good practice to reduce the number of layers in the images. Sometimes that's done by cleverly hacking the Container/Dockerfile. I am worried that with a sufficiently complex Container/Dockerfile these hacks will lead to convoluted code that's hard to read and debug.
Therefore, I was thinking that it might be simpler to have the build doing the squashing for us.
I suspect that the switch to Podman and Buildah based GitHub Actions to build the images also fixed this. Compare this to the earlier output above:
$ skopeo inspect --format '{{.Layers}}' docker://quay.io/toolbx-images/ubuntu-toolbox:20.04
[sha256:fa1c8595265700fcd3c36de73ee8167969927e8661c2168508f18857f275f752
sha256:88968c9355b780e3702af2ce6a374f6d641476380b294e9b97a68de1e989f9b2]
I see that we are using layers: false
with redhat-actions/buildah-build@v2. I am not sure exactly what it means, and there are subtle differences between podman build --squash
and buildah bud --squash
(it's the same as podman build --squash-all
). I suppose, we can use extra-args: ...
to clarify this further, but looking at the skopeo(1)
output above, I think this is fixed.
Thanks for the update!
Image and version of the image where the issue happens
Possibly all the images. I have checked the images for Arch Linux and Ubuntu.
Describe the bug
The images have several layers, which are probably remnants from the lines in the Containerfiles. Compare the
quay.io/toolbx-images/ubuntu-toolbox:20.04
image:... with the
registry.fedoraproject.org/fedora-toolbox:38
image:The Fedora build system squashes the layers. It uses Docker for the build, but I think it's the equivalent of
podman build --squash
. The other option is to hack the Containerfiles in a way that it avoids the creation of extra layers, but that might eventually lead to convulated code.Reproduction steps
See above.
Host distribution and version, toolbx and podman versions
podman-4.4.1-3.fc36.x86_64