wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
47.42k stars 1.79k forks source link

Do not mark base image files as inefficient files even it was installed through any dep #454

Open vkosuri opened 1 year ago

vkosuri commented 1 year ago

Hi,

I use dive_0.9.2_linux_amd64.deb on Ubuntu 22, My container already had the Perl package and its modules.

One of my docker RUN commands installs Perl packages as dependencies due to this Perl marking as inefficient Files,

Could you please let me know how to overcome this?

kosuri@kosuri ~/git/test
❯ CI=true dive debug-test:v7.106.0-dev
  Using default CI config
Image Source: docker://debug-test:v7.106.0-dev
Fetching image... (this can take a while for large images)
Analyzing image...
  efficiency: 97.1840 %
  wastedBytes: 16075324 bytes (16 MB)
  userWastedPercent: 8.3853 %
Inefficient Files:
Count  Wasted Space  File Path
    2        7.6 MB  /usr/bin/perl
    2        1.3 MB  /usr/lib/x86_64-linux-gnu/perl-base/auto/re/re.so
    2        801 kB  /usr/lib/x86_64-linux-gnu/perl-base/unicore/To/NFKCCF.pl
    2        614 kB  /var/log/lastlog
    2        258 kB  /var/lib/dpkg/status
    2        221 kB  /usr/lib/x86_64-linux-gnu/perl-base/auto/POSIX/POSIX.so
    2        219 kB  /usr/share/doc/perl-base/copyright
    2        170 kB  /usr/lib/x86_64-linux-gnu/perl-base/File/Temp.pm

Results:
  PASS: highestUserWastedPercent
  SKIP: highestWastedBytes: rule disabled
  PASS: lowestEfficiency
Result:PASS [Total:3] [Passed:2] [Failed:0] [Warn:0] [Skipped:1]