I am trying create cron a task in docker container. Everything are configured according to the @VonC 's answer
My dockerfile looks like this
FROM python:3.6.9
WORKDIR usr/src/mydir
COPY requirements.txt .
# Add crontab file in the cron directory
ADD crontab /etc/cron.d/hello-cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/hello-cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
#Install Cron
RUN apt-get update
RUN apt-get -y install cron
# Run the command on container startup
CMD cron && tail -f /var/log/cron.log
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
But the cron service doesn’t start up by default
[FAIL] cron is not running ... failed!
the cron service starts work after pushing it explicitly from the container
service cron start
what's wrong?