diff --git a/README.md b/README.md index 71b1f30..1a1ac73 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # A minimal Ubuntu base image modified for Docker-friendliness -[![](https://badge.imagelayers.io/phusion/baseimage:0.9.17.svg)](https://imagelayers.io/?images=phusion/baseimage:latest 'Get your own badge on imagelayers.io') +[![](https://badge.imagelayers.io/phusion/baseimage:latest.svg)](https://imagelayers.io/?images=phusion/baseimage:latest 'Get your own badge on imagelayers.io') [![Travis](https://img.shields.io/travis/phusion/baseimage-docker.svg)](https://travis-ci.org/phusion/baseimage-docker) -_Baseimage-docker only consumes 6 MB RAM and is much powerful than Busybox or Alpine. See why below._ +_Baseimage-docker only consumes 6 MB RAM and is much more powerful than Busybox or Alpine. See why below._ Baseimage-docker is a special [Docker](https://www.docker.com) image that is configured for correct use within Docker containers. It is Ubuntu, plus: @@ -96,6 +96,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` | 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. @@ -494,7 +495,7 @@ Edit your Dockerfile to install the insecure key permanently: RUN /usr/sbin/enable_insecure_key -Instructions for logging in the container is the same as in section [Using the insecure key for one container only](#using_the_insecure_key_for_one_container_only). +Instructions for logging into the container is the same as in section [Using the insecure key for one container only](#using_the_insecure_key_for_one_container_only). #### Using your own key diff --git a/image/bin/install_clean b/image/bin/install_clean new file mode 100755 index 0000000..3f829bc --- /dev/null +++ b/image/bin/install_clean @@ -0,0 +1,17 @@ +#!/bin/bash -e +# Apt installer helper for Docker images + +ARGS="$*" +NO_RECOMMENDS="--no-install-recommends" +RECOMMENDS="--install-recommends" +if [[ $ARGS =~ "$RECOMMENDS" ]]; then + NO_RECOMMENDS="" + ARGS=$(sed "s/$RECOMMENDS//g" <<<"$ARGS") +fi + +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/* diff --git a/image/services/syslog-ng/logrotate_syslogng b/image/services/syslog-ng/logrotate_syslogng index 114cb09..38ad512 100644 --- a/image/services/syslog-ng/logrotate_syslogng +++ b/image/services/syslog-ng/logrotate_syslogng @@ -8,7 +8,6 @@ compress postrotate sv reload syslog-ng > /dev/null - sv restart syslog-forwarder > /dev/null endscript } @@ -34,6 +33,5 @@ sharedscripts postrotate sv reload syslog-ng > /dev/null - sv restart syslog-forwarder > /dev/null endscript } diff --git a/image/services/syslog-ng/syslog-forwarder.runit b/image/services/syslog-ng/syslog-forwarder.runit deleted file mode 100755 index 5bd832f..0000000 --- a/image/services/syslog-ng/syslog-forwarder.runit +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec tail -F -n 0 /var/log/syslog diff --git a/image/services/syslog-ng/syslog-ng.conf b/image/services/syslog-ng/syslog-ng.conf index 9dc76a3..11f6b41 100644 --- a/image/services/syslog-ng/syslog-ng.conf +++ b/image/services/syslog-ng/syslog-ng.conf @@ -74,6 +74,9 @@ destination d_xconsole { pipe("/dev/xconsole"); }; # Debian only destination d_ppp { file("/var/log/ppp.log"); }; +# stdout for docker +destination d_stdout { pipe("/dev/stdout"); }; + ######################## # Filters ######################## @@ -119,7 +122,7 @@ log { source(s_src); filter(f_cron); destination(d_cron); }; log { source(s_src); filter(f_daemon); destination(d_daemon); }; log { source(s_src); filter(f_kern); destination(d_kern); }; log { source(s_src); filter(f_lpr); destination(d_lpr); }; -log { source(s_src); filter(f_syslog3); destination(d_syslog); }; +log { source(s_src); filter(f_syslog3); destination(d_syslog); destination(d_stdout); }; log { source(s_src); filter(f_user); destination(d_user); }; log { source(s_src); filter(f_uucp); destination(d_uucp); }; diff --git a/image/services/syslog-ng/syslog-ng.sh b/image/services/syslog-ng/syslog-ng.sh index db48fde..a62c064 100755 --- a/image/services/syslog-ng/syslog-ng.sh +++ b/image/services/syslog-ng/syslog-ng.sh @@ -15,10 +15,6 @@ touch /var/log/syslog chmod u=rw,g=r,o= /var/log/syslog cp $SYSLOG_NG_BUILD_PATH/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf -## Install syslog to "docker logs" forwarder. -mkdir /etc/service/syslog-forwarder -cp $SYSLOG_NG_BUILD_PATH/syslog-forwarder.runit /etc/service/syslog-forwarder/run - ## Install logrotate. $minimal_apt_get_install logrotate cp $SYSLOG_NG_BUILD_PATH/logrotate.conf /etc/logrotate.conf diff --git a/image/utilities.sh b/image/utilities.sh index 9f0c1a9..d1aa273 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 /sbin/install_clean