shift logs to host before docker startup, keep old logs

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-03-17 15:27:50 +00:00
parent 6178bb2221
commit 65c187a0dd

View File

@ -10,6 +10,25 @@ start()
{
ebegin "Starting Docker"
# shift logs onto host before docker starts
# try to keep initial log files, although there is a race
# busybox reopens its log files every second
if cat /proc/cmdline | grep -q 'com.docker.driverDir'
then
DRIVERDIR="/Mac$(cat /proc/cmdline | sed -e 's/.*com.docker.driverDir="//' -e 's/".*//')"
rm -rf /var/tmp/log
mkdir -p /var/tmp/log
for f in /var/log/*
do
cp -a $f /var/tmp/log/$(basename $f)
done
mount --bind "${DRIVERDIR}/log" /var/log
for f in /var/tmp/log/*
do
cat -a $f >> /var/log/$(basename $f)
done
fi
export DOCKER_RAMDISK="true"
command="${DOCKER_BINARY:-/usr/bin/docker}"