diff --git a/README.md b/README.md index 6864072..b123b60 100644 --- a/README.md +++ b/README.md @@ -95,6 +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. | 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 new file mode 100755 index 0000000..2a5310b --- /dev/null +++ b/image/bin/install_clean.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Apt installer helper for Docker images + +set -e + +echo "Installing $*" +apt-get -q update && apt-get -qy install $* \ + && apt-get -qy autoremove \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/* diff --git a/image/utilities.sh b/image/utilities.sh index 9f0c1a9..8b452db 100755 --- a/image/utilities.sh +++ b/image/utilities.sh @@ -9,3 +9,6 @@ ln -s /usr/bin/vim.tiny /usr/bin/vim ## This tool runs a command as another user and sets $HOME. cp /bd_build/bin/setuser /sbin/setuser + +## This tool allows installation of apt packages with automatic cache cleanup. +cp /bd_build/bin/install_clean.sh /sbin/install_clean.sh