containers / buildah

A tool that facilitates building OCI images.
https://buildah.io
Apache License 2.0
7.44k stars 785 forks source link

buildah pulls in kernel, dracut and others #874

Closed Spindel closed 6 years ago

Spindel commented 6 years ago

Description

The buildah dependency graph is really huge on Fedora, turning a simple build container into a 700MB+ beast.

the majority of it seems to be via ostree, pulling in dracut, systemd-udev, linux-firmware, kernel-core and others.

Steps to reproduce the issue:

  1. start with empty fedora container
  2. dnf install buildah
  3. check size and dependency graph

Dependencies resolved.

Package Arch Version Repository Size

Installing: buildah x86_64 1.1-1.gitfbf46d3.fc28 updates 3.8 M Installing dependencies: GeoIP-GeoLite-data noarch 2018.06-1.fc28 updates 551 k checkpolicy x86_64 2.8-1.fc28 updates 336 k container-selinux noarch 2:2.65-1.gitbf5b26b.fc28 updates 42 k containers-common x86_64 0.1.31-5.git0144aa8.fc28 updates 30 k cpio x86_64 2.12-7.fc28 fedora 264 k dracut x86_64 048-1.fc28 updates 352 k findutils x86_64 1:4.6.0-19.fc28 updates 526 k fuse-libs x86_64 2.9.7-11.fc28 fedora 100 k hostname x86_64 3.20-3.fc28 fedora 29 k initscripts x86_64 9.80-1.fc28 updates 390 k ipcalc x86_64 0.2.3-1.fc28 updates 36 k iproute x86_64 4.16.0-1.fc28 updates 558 k iputils x86_64 20161105-9.fc28 fedora 158 k kbd-legacy noarch 2.0.4-5.fc28 fedora 480 k kbd-misc noarch 2.0.4-5.fc28 fedora 1.4 M kernel-core x86_64 4.17.6-200.fc28 updates 24 M kmod x86_64 25-2.fc28 fedora 116 k libcgroup x86_64 0.41-17.fc28 updates 68 k libkcapi x86_64 1.1.1-3.fc28 updates 43 k libkcapi-hmaccalc x86_64 1.1.1-3.fc28 updates 26 k libmnl x86_64 1.0.4-6.fc28 fedora 29 k libnet x86_64 1.1.6-15.fc28 fedora 66 k libnl3 x86_64 3.4.0-3.fc28 fedora 307 k libselinux-utils x86_64 2.7-13.fc28 fedora 165 k linux-atm-libs x86_64 2.5.1-20.fc28 fedora 41 k linux-firmware noarch 20180525-85.git7518922b.fc28 updates 65 M ostree x86_64 2018.6-4.fc28 updates 224 k ostree-libs x86_64 2018.6-4.fc28 updates 377 k policycoreutils x86_64 2.7-18.fc28 fedora 732 k policycoreutils-python-utils noarch 2.7-18.fc28 fedora 224 k procps-ng x86_64 3.3.12-3.fc28 updates 404 k protobuf-c x86_64 1.3.0-4.fc28 fedora 36 k python3-IPy noarch 0.81-21.fc28 fedora 42 k python3-audit x86_64 2.8.3-3.fc28 fedora 83 k python3-libselinux x86_64 2.7-13.fc28 fedora 254 k python3-libsemanage x86_64 2.7-12.fc28 fedora 125 k python3-policycoreutils noarch 2.7-18.fc28 fedora 1.8 M python3-setools x86_64 4.1.1-6.fc28 fedora 588 k runc x86_64 2:1.0.0-36.gitad0f525.fc28 updates 2.0 M selinux-policy noarch 3.14.1-32.fc28 updates 554 k selinux-policy-targeted noarch 3.14.1-32.fc28 updates 14 M systemd-udev x86_64 238-7.fc28.1 fedora 1.3 M xz x86_64 5.2.3-7.fc28 fedora 151 k Installing weak dependencies: GeoIP x86_64 1.6.12-3.fc28 fedora 123 k criu x86_64 3.9-1.fc28 updates 476 k hardlink x86_64 1:1.3-6.fc28 fedora 28 k iproute-tc x86_64 4.16.0-1.fc28 updates 397 k kbd x86_64 2.0.4-5.fc28 fedora 387 k kpartx x86_64 0.7.4-2.git07e7bd5.fc28 fedora 95 k pigz x86_64 2.4-2.fc28 fedora 77 k systemd-bootchart x86_64 233-1.fc28 fedora 67 k

Transaction Summary

Install 52 Packages

Total download size: 124 M Installed size: 369 M

rhatdan commented 6 years ago

I have removed the ostree requirement from buildah in the spec file. Fedora/RHEL rebuilds happening now.

rhatdan commented 6 years ago

@lsm5 I don't think we use ostree in any other distros.

rhatdan commented 6 years ago

buildah-1.2-2.gitbe87762.*

lsm5 commented 6 years ago

only other distro being ubuntu, (considering centos == rhel), we don't use ostree on ubuntu.

Spindel commented 6 years ago
dnf install --setopt install_weak_deps=false  https://kojipkgs.fedoraproject.org//packages/buildah/1.2/2.gitbe87762.fc28/x86_64/buildah-1.2-2.gitbe87762.fc28.x86_64.rpm
buildah-1.2-2.gitbe87762.fc28.x86_64.rpm                                                                                                                                                                                                                    3.8 MB/s | 3.9 MB     00:01    
Dependencies resolved.
============================================================================================================================================================================================================================================================================================
 Package                                                                        Arch                                                     Version                                                                       Repository                                                      Size
============================================================================================================================================================================================================================================================================================
Installing:
 buildah                                                                        x86_64                                                   1.2-2.gitbe87762.fc28                                                         @commandline                                                   3.9 M
Installing dependencies:
 checkpolicy                                                                    x86_64                                                   2.8-1.fc28                                                                    updates                                                        336 k
 container-selinux                                                              noarch                                                   2:2.65-1.gitbf5b26b.fc28                                                      updates                                                         42 k
 containers-common                                                              x86_64                                                   0.1.31-5.git0144aa8.fc28                                                      updates                                                         30 k
 libcgroup                                                                      x86_64                                                   0.41-17.fc28                                                                  updates                                                         68 k
 libselinux-utils                                                               x86_64                                                   2.7-13.fc28                                                                   fedora                                                         165 k
 ostree-libs                                                                    x86_64                                                   2018.6-4.fc28                                                                 updates                                                        377 k
 policycoreutils                                                                x86_64                                                   2.7-18.fc28                                                                   fedora                                                         732 k
 policycoreutils-python-utils                                                   noarch                                                   2.7-18.fc28                                                                   fedora                                                         224 k
 python3-IPy                                                                    noarch                                                   0.81-21.fc28                                                                  fedora                                                          42 k
 python3-audit                                                                  x86_64                                                   2.8.3-3.fc28                                                                  fedora                                                          83 k
 python3-libselinux                                                             x86_64                                                   2.7-13.fc28                                                                   fedora                                                         254 k
 python3-libsemanage                                                            x86_64                                                   2.7-12.fc28                                                                   fedora                                                         125 k
 python3-policycoreutils                                                        noarch                                                   2.7-18.fc28                                                                   fedora                                                         1.8 M
 python3-setools                                                                x86_64                                                   4.1.1-6.fc28                                                                  fedora                                                         588 k
 runc                                                                           x86_64                                                   2:1.0.0-36.gitad0f525.fc28                                                    updates                                                        2.0 M
 selinux-policy                                                                 noarch                                                   3.14.1-32.fc28                                                                updates                                                        554 k
 selinux-policy-targeted                                                        noarch                                                   3.14.1-32.fc28                                                                updates                                                         14 M

Transaction Summary
============================================================================================================================================================================================================================================================================================
Install  18 Packages

Total size: 26 M
Total download size: 22 M
Installed size: 82 M

After that, one can do:

[root@be0527c5aba2 /]# dnf remove selinux-policy-targeted 
Dependencies resolved.
============================================================================================================================================================================================================================================================================================
 Package                                                                        Arch                                                          Version                                                                 Repository                                                       Size
============================================================================================================================================================================================================================================================================================
Removing:
 selinux-policy-targeted                                                        noarch                                                        3.14.1-32.fc28                                                          @updates                                                         48 M

Transaction Summary
============================================================================================================================================================================================================================================================================================
Remove  1 Package

Freed space: 48 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                    1/1 
  Erasing          : selinux-policy-targeted-3.14.1-32.fc28.noarch                                                                                                                                                                                                                      1/1 
  Running scriptlet: selinux-policy-targeted-3.14.1-32.fc28.noarch                                                                                                                                                                                                                      1/1 
  Verifying        : selinux-policy-targeted-3.14.1-32.fc28.noarch                                                                                                                                                                                                                      1/1 

Removed:
  selinux-policy-targeted.noarch 3.14.1-32.fc28                                                                                                                                                                                                                                             

Complete!

Is there a better way to not get the selinux-policy-targeted installed as a dependency?

rhatdan commented 6 years ago

Buildah is requiring container-selinux, which could also be dropped. buildah does not require selinux to run. it uses SELinux if it is there, and will not run well if it is there and container-selinux is not installed. @lsm5 Could we make this a soft dependency?

rhatdan commented 6 years ago

@lsm5 @nalind Is there a way using dependency resolution to check if selinux-policy-base ins installed then I want to install container-selinux, but if it is not installed, then don't install either?