diff --git a/README.md b/README.md index b123b60..691439c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/image/bin/install_clean.sh b/image/bin/install_clean.sh index 2a5310b..3f829bc 100755 --- a/image/bin/install_clean.sh +++ b/image/bin/install_clean.sh @@ -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/*