1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Set "Apt::AutoRemove::SuggestsImportant" to "false" in debootstrap

This makes APT be appropriately aggressive about removing packages it added due to `Recommends` or `Depends` if the packages they were added for are removed (even if other packages only have the softer `Suggests` relationship).

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
This commit is contained in:
Tianon Gravi 2015-03-02 18:42:26 -07:00
parent dec67f7f57
commit e6a18da53f

View file

@ -118,6 +118,27 @@ if [ -d "$rootfsDir/etc/apt/apt.conf.d" ]; then
Acquire::GzipIndexes "true"; Acquire::GzipIndexes "true";
Acquire::CompressionTypes::Order:: "gz"; Acquire::CompressionTypes::Order:: "gz";
EOF EOF
# update "autoremove" configuration to be aggressive about removing suggests deps that weren't manually installed
echo >&2 "+ echo Apt::AutoRemove::SuggestsImportant 'false' > '$rootfsDir/etc/apt/apt.conf.d/docker-autoremove-suggests'"
cat > "$rootfsDir/etc/apt/apt.conf.d/docker-autoremove-suggests" <<-'EOF'
# Since Docker users are looking for the smallest possible final images, the
# following emerges as a very common pattern:
# RUN apt-get update \
# && apt-get install -y <packages> \
# && <do some compilation work> \
# && apt-get purge -y --auto-remove <packages>
# By default, APT will actually _keep_ packages installed via Recommends or
# Depends if another package Suggests them, even and including if the package
# that originally caused them to be installed is removed. Setting this to
# "false" ensures that APT is appropriately aggressive about removing the
# packages it added.
# https://aptitude.alioth.debian.org/doc/en/ch02s05s05.html#configApt-AutoRemove-SuggestsImportant
Apt::AutoRemove::SuggestsImportant "false";
EOF
fi fi
if [ -z "$DONT_TOUCH_SOURCES_LIST" ]; then if [ -z "$DONT_TOUCH_SOURCES_LIST" ]; then