Added --no-install-recommends by default

This commit is contained in:
Steve Kamerman
2017-10-17 16:39:19 -04:00
committed by Kingdon Barrett
parent fcc1283c85
commit c41f837f82
2 changed files with 12 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ You can configure the stock `ubuntu` image yourself from your Dockerfile, so why
| cron | The cron daemon must be running for cron jobs to work. |
| [runit](http://smarden.org/runit/) | Replaces Ubuntu's Upstart. Used for service supervision and management. Much easier to use than SysV init and supports restarting daemons when they crash. Much easier to use and more lightweight than Upstart. |
| `setuser` | A tool for running a command as another user. Easier to use than `su`, has a smaller attack vector than `sudo`, and unlike `chpst` this tool sets `$HOME` correctly. Available as `/sbin/setuser`. |
| `install_clean.sh` | A tool for installing `apt` packages that automatically cleans up after itself. All arguments are passed to `apt-get -y install` and after installation the apt caches are cleared. |
| `install_clean.sh` | A tool for installing `apt` packages that automatically cleans up after itself. All arguments are passed to `apt-get -y install --no-install-recommends` and after installation the apt caches are cleared. To include recommended packages, add `--install-recommends`. |
Baseimage-docker is very lightweight: it only consumes 6 MB of memory.

View File

@@ -1,10 +1,17 @@
#!/bin/sh
#!/bin/bash -e
# Apt installer helper for Docker images
set -e
ARGS="$*"
NO_RECOMMENDS="--no-install-recommends"
RECOMMENDS="--install-recommends"
if [[ $ARGS =~ "$RECOMMENDS" ]]; then
NO_RECOMMENDS=""
ARGS=$(sed "s/$RECOMMENDS//g" <<<"$ARGS")
fi
echo "Installing $*"
apt-get -q update && apt-get -qy install $* \
echo "Installing $ARGS"
apt-get -q update && apt-get -qy install $NO_RECOMMENDS $ARGS \
&& apt-get -qy autoremove \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*