mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
add a script to move all logs to host
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
78bd5af1ac
commit
c5525c8a7a
@ -40,6 +40,7 @@ COPY packages/dnsfix/etc /etc/
|
|||||||
COPY packages/database/etc /etc/
|
COPY packages/database/etc /etc/
|
||||||
COPY packages/hupper/hupper /bin/
|
COPY packages/hupper/hupper /bin/
|
||||||
COPY packages/hupper/etc /etc/
|
COPY packages/hupper/etc /etc/
|
||||||
|
COPY packages/hostlog/etc /etc/
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
rc-update add swap boot && \
|
rc-update add swap boot && \
|
||||||
@ -75,6 +76,7 @@ RUN \
|
|||||||
rc-update add dnsfix boot && \
|
rc-update add dnsfix boot && \
|
||||||
rc-update add database boot && \
|
rc-update add database boot && \
|
||||||
rc-update add hupper default && \
|
rc-update add hupper default && \
|
||||||
|
rc-update add hostlog default && \
|
||||||
ln -s /bin/busybox /init
|
ln -s /bin/busybox /init
|
||||||
|
|
||||||
CMD ["/bin/sh"]
|
CMD ["/bin/sh"]
|
||||||
|
@ -6,12 +6,6 @@ command="${DOCKER_BINARY:-/usr/bin/docker}"
|
|||||||
|
|
||||||
pidfile="/run/docker.pid"
|
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'
|
if cat /proc/cmdline | grep -q 'com.docker.database'
|
||||||
then
|
then
|
||||||
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
|
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
|
||||||
@ -21,7 +15,8 @@ fi
|
|||||||
|
|
||||||
command_args="daemon -p \"${pidfile}\" ${DOCKER_OPTS}"
|
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 \
|
start_stop_daemon_args="--background \
|
||||||
--stderr \"${DOCKER_LOGFILE}\" --stdout \"${DOCKER_LOGFILE}\""
|
--stderr \"${DOCKER_LOGFILE}\" --stdout \"${DOCKER_LOGFILE}\""
|
||||||
|
|
||||||
|
19
alpine/packages/hostlog/etc/init.d/hostlog
Executable file
19
alpine/packages/hostlog/etc/init.d/hostlog
Executable 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"
|
Loading…
Reference in New Issue
Block a user