Merge branch 'master' into syslog-shutdown

This commit is contained in:
Travis Rowland
2017-10-30 11:59:01 -07:00
committed by GitHub
7 changed files with 28 additions and 12 deletions

View File

@@ -1,9 +1,9 @@
# A minimal Ubuntu base image modified for Docker-friendliness # 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) [![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: Baseimage-docker is a special [Docker](https://www.docker.com) image that is configured for correct use within Docker containers. It is Ubuntu, plus:
@@ -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. | | 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. | | [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`. | | `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. Baseimage-docker is very lightweight: it only consumes 6 MB of memory.
@@ -485,7 +486,7 @@ Edit your Dockerfile to install the insecure key permanently:
RUN /usr/sbin/enable_insecure_key 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).
<a name="using_your_own_key"></a> <a name="using_your_own_key"></a>
#### Using your own key #### Using your own key

17
image/bin/install_clean Executable file
View File

@@ -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/*

View File

@@ -8,7 +8,6 @@
compress compress
postrotate postrotate
sv reload syslog-ng > /dev/null sv reload syslog-ng > /dev/null
sv restart syslog-forwarder > /dev/null
endscript endscript
} }
@@ -34,6 +33,5 @@
sharedscripts sharedscripts
postrotate postrotate
sv reload syslog-ng > /dev/null sv reload syslog-ng > /dev/null
sv restart syslog-forwarder > /dev/null
endscript endscript
} }

View File

@@ -1,2 +0,0 @@
#!/bin/sh
exec tail -F -n 0 /var/log/syslog

View File

@@ -74,6 +74,9 @@ destination d_xconsole { pipe("/dev/xconsole"); };
# Debian only # Debian only
destination d_ppp { file("/var/log/ppp.log"); }; destination d_ppp { file("/var/log/ppp.log"); };
# stdout for docker
destination d_stdout { pipe("/dev/stdout"); };
######################## ########################
# Filters # 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_daemon); destination(d_daemon); };
log { source(s_src); filter(f_kern); destination(d_kern); }; 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_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_user); destination(d_user); };
log { source(s_src); filter(f_uucp); destination(d_uucp); }; log { source(s_src); filter(f_uucp); destination(d_uucp); };

View File

@@ -15,10 +15,6 @@ touch /var/log/syslog
chmod u=rw,g=r,o= /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 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. ## Install logrotate.
$minimal_apt_get_install logrotate $minimal_apt_get_install logrotate
cp $SYSLOG_NG_BUILD_PATH/logrotate.conf /etc/logrotate.conf cp $SYSLOG_NG_BUILD_PATH/logrotate.conf /etc/logrotate.conf

View File

@@ -9,3 +9,6 @@ ln -s /usr/bin/vim.tiny /usr/bin/vim
## This tool runs a command as another user and sets $HOME. ## This tool runs a command as another user and sets $HOME.
cp /bd_build/bin/setuser /sbin/setuser 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