Closed psychemedia closed 3 years ago
The clean may also clobber sources?
Clobber sources in what way?
Delete the path to them. I just checked, you don't, they go to /etc/apt/sources.list.d/
and the clean up cleans /var/lib/apt/lists/*
.
The addition of the lists adds time to each apt-get
update though. If you have the iterated Dockerfile builder that builds up from several files, and each apt-get step has its own apt-get update and clean step, and each adds its own sources, the source list could get very long and the apt-get update could take forever on the final step.
Most of the time this won't be an issue. Just noting what could happen, though.
Ok. Well, it is the classic memory vs processing time tradeoff.
Three options:
apt-get upgrade
..apt-clean
etc.The no-recommends is a separate decision which could be set by the user via an optional install-recommends
boolean (just need to decide the default) in the config file.
The base layer already comes with the necessary settings so that apt doesn't cache anything. Removing the /var/lib/apt/lists/*
reduces the size by ~10MB on the big demo, so is really not worth it.
Apt installs can be tidied up and layer size reduced by adding an
&& apt-get clean && rm -rf /var/lib/apt/lists/*
tidy up step.Unwanted packages can be limited by a
--no-install-recommmends
switch in anapt-get
command.To impact on layer size, the apt-get clean needs running as part of every apt-get layer, which means that multiple layers need their own
apt-get update
.However, just running it once does make for a slightly cleaner filesystem in the final container.