From 8f8de4cbf055d04bc8c52dc6723a62b745284f10 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Tue, 21 Nov 2017 10:30:09 +0100 Subject: [PATCH] [FIX]Fix overlayfs problem with tail and cron via docker VOLUMES --- backups/rsyncvolumes/Dockerfile | 4 +++- backups/rsyncvolumes/launch.sh | 2 +- odoo/backups/Dockerfile | 6 ++++-- odoo/backups/launch.sh | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backups/rsyncvolumes/Dockerfile b/backups/rsyncvolumes/Dockerfile index 52747bf..845c0f0 100644 --- a/backups/rsyncvolumes/Dockerfile +++ b/backups/rsyncvolumes/Dockerfile @@ -7,9 +7,11 @@ ENV DEST /var/backups/ RUN apt-get update && apt-get install --no-install-recommends -y \ cron gettext-base rsync python-minimal libpython-stdlib +# Avoid overlayfs bug with tail +VOLUME /var/log + COPY crontab /etc/crontab RUN chmod 644 /etc/crontab -RUN touch /var/log/cron.log WORKDIR /opt/backup COPY rsync.template . diff --git a/backups/rsyncvolumes/launch.sh b/backups/rsyncvolumes/launch.sh index a598515..29ad6bc 100644 --- a/backups/rsyncvolumes/launch.sh +++ b/backups/rsyncvolumes/launch.sh @@ -2,4 +2,4 @@ envsubst < /opt/backup/rsync.template > /opt/backup/rsync.sh envsubst < /opt/backup/plan.tpl.py > /opt/backup/plan.py -cron && tail -f /var/log/cron.log +touch /var/log/cron.log && cron && tail -f /var/log/cron.log diff --git a/odoo/backups/Dockerfile b/odoo/backups/Dockerfile index ca4cedc..ab9e538 100644 --- a/odoo/backups/Dockerfile +++ b/odoo/backups/Dockerfile @@ -10,15 +10,17 @@ USER root RUN mkdir backups RUN apt-get install -y --no-install-recommends cron gettext-base +# Avoid overlayfs bug with tail +VOLUME /var/log + COPY crontab /etc/crontab RUN chmod 644 /etc/crontab -RUN touch /var/log/cron.log COPY backup.template . COPY plan.py . COPY launch.sh . -RUN chown -R odoo:odoo . && chown odoo:odoo /var/log/cron.log +RUN chown -R odoo:odoo . VOLUME /home/odoo/backups CMD bash launch.sh diff --git a/odoo/backups/launch.sh b/odoo/backups/launch.sh index cfc0505..098b975 100644 --- a/odoo/backups/launch.sh +++ b/odoo/backups/launch.sh @@ -2,4 +2,4 @@ envsubst < /home/odoo/backup.template > /home/odoo/backup.sh chown odoo:odoo /home/odoo/backup.sh -cron && tail -f /var/log/cron.log +touch /var/log/cron.log && cron && tail -f /var/log/cron.log