add a script to move all logs to host

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-01-27 13:36:36 +00:00
parent 78bd5af1ac
commit c5525c8a7a
3 changed files with 23 additions and 7 deletions

View File

@ -40,6 +40,7 @@ COPY packages/dnsfix/etc /etc/
COPY packages/database/etc /etc/
COPY packages/hupper/hupper /bin/
COPY packages/hupper/etc /etc/
COPY packages/hostlog/etc /etc/
RUN \
rc-update add swap boot && \
@ -75,6 +76,7 @@ RUN \
rc-update add dnsfix boot && \
rc-update add database boot && \
rc-update add hupper default && \
rc-update add hostlog default && \
ln -s /bin/busybox /init
CMD ["/bin/sh"]

View File

@ -6,12 +6,6 @@ command="${DOCKER_BINARY:-/usr/bin/docker}"
pidfile="/run/docker.pid"
if cat /proc/cmdline | grep -q 'com.docker.groupDir'
then
GROUPDIR="/Mac$(cat /proc/cmdline | sed -e 's/.*com.docker.groupDir="//' -e 's/".*//')"
[ -d "${GROUPDIR}" ] && DOCKER_LOGFILE="${GROUPDIR}/docker.log"
fi
if cat /proc/cmdline | grep -q 'com.docker.database'
then
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
@ -21,7 +15,8 @@ fi
command_args="daemon -p \"${pidfile}\" ${DOCKER_OPTS}"
DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}"
DOCKER_LOGFILE="/var/log/docker.log}"
start_stop_daemon_args="--background \
--stderr \"${DOCKER_LOGFILE}\" --stdout \"${DOCKER_LOGFILE}\""

View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
depends()
{
before acpid docker syslog chronyd
after 9pinit 9pudfuse
}
start()
{
cat /proc/cmdline | grep -q 'com.docker.groupDir' || exit 0
ebegin "Redirecting logs to host"
GROUPDIR="/Mac$(cat /proc/cmdline | sed -e 's/.*com.docker.groupDir="//' -e 's/".*//')"
mount --bind "${GROUPDIR}" /var/log
eend $? "Failed to redirect logs to host"