Archivos Cron y Crontab no ejecutados en Docker

Tengo este Dockerfile simple para probar, pero también es el mismo en mi pila LEMP en una imagen PHP: los trabajos cron simplemente no se ejecutan en Docker.

Esta es mi prueba Dockerfile:

FROM debian:latest
MAINTAINER XY <[email protected]>
LABEL Description="Cron" Vendor="Istvan Lantos" Version="1.0"

RUN apt-get -y update && apt-get -y dist-upgrade \
    && apt-get -y install \
        cron \
        rsyslog \
        vim

RUN rm -rf /var/lib/apt/lists/*

#cron fixes
RUN touch /etc/crontab /etc/cron.d/* /var/spool/cron/crontabs/*
#COPY etc/cron.d /etc/cron.d
COPY etc/crontab /etc/crontab
#COPY var/spool/cron/crontabs /var/spool/cron/crontabs
RUN chmod 600 /etc/crontab /etc/cron.d/* /var/spool/cron/crontabs/*
RUN touch /etc/crontab /etc/cron.d/* /var/spool/cron/crontabs/*

RUN rm -rf /var/lib/apt/lists/*

COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
CMD ["/docker-entrypoint.sh"]

docker-entrypoint.sh:

#!/bin/bash
set -e

echo PID1 > /dev/null

/etc/init.d/rsyslog start

#Stay in foreground mode, don’t daemonize.
/usr/sbin/cron -f

Y este es el archivo Crontab. También puse un revestimiento en/etc/cron.d o/var/spool/cron/crontabs con el nombre del usuario, pero el efecto fue el mismo que si modificara este archivo crontab base: los trabajos cron no se ejecutarán:

MAILTO=""
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/php7/bin:/usr/local/php7/sbin

# m h dom mon dow user  command
#17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
#25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
#47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
#52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
*/1 *   * * *   root    date >> /var/log/cron-test.log 2>&1

Esta es la salida de la/var/log/syslog archivo:

Jan 23 09:38:39 1ab854e8d9a7 rsyslogd: [origin software="rsyslogd" swVersion="8.4.2" x-pid="14" x-info="http://www.rsyslog.com"] start
Jan 23 09:38:39 1ab854e8d9a7 rsyslogd: imklog: cannot open kernel log(/proc/kmsg): Operation not permitted.
Jan 23 09:38:39 1ab854e8d9a7 rsyslogd-2145: activation of module imklog failed [try http://www.rsyslog.com/e/2145 ]
Jan 23 09:38:39 1ab854e8d9a7 cron[19]: (CRON) INFO (pidfile fd = 3)
Jan 23 09:38:39 1ab854e8d9a7 cron[19]: (*system*) NUMBER OF HARD LINKS > 1 (/etc/crontab)
Jan 23 09:38:39 1ab854e8d9a7 cron[19]: (*) ORPHAN (no passwd entry)
Jan 23 09:38:39 1ab854e8d9a7 cron[19]: (CRON) INFO (Running @reboot jobs)

/var/log/cron-test.log no será creado por el trabajo cron.

Tengo una pregunta para aquellos que marcaron esto como "fuera de tema" y material de Superusuario, además de que se trata de hardware y SOFTWARE de computación general: ¿en serio? ¿Docker pregunta cuándo convertirse en material de administrador de sistemas? De esta manera, todas las preguntas relacionadas con Docker aquí tienen al menos una bandera. No estoy en contra de promocionar más usuarios en los sitios secundarios menos conocidos, pero tenemos más cambios para obtener la respuesta aquí que los suyos.

ACTUALIZAR:

Esto es lo que se me ocurre hasta que los trabajos cron no funcionan:

Fin del Dockerfile:

COPY cron-jobs.sh /
RUN chmod +x /cron-jobs.sh

COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
CMD ["/docker-entrypoint.sh"]

docker-entrypoint.sh:

#!/bin/bash
set -e

echo PID1 > /dev/null

# Run script in the background (this is not daemonized)
/cron-jobs.sh &

/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf

cron-jobs.sh:

#!/bin/bash

while true; do
  date >> /var/log/cron-test.log 2>&1
  sleep 60
done

Respuestas a la pregunta(1)

Su respuesta a la pregunta