docker-cron
docker-cron copied to clipboard
Ubuntu: /etc/crontab must be 0644 or will not work [it does not work in your way]
Your method of loading the crontab via a volume does not work, at least in Ubuntu jammy as base image.
The issue is that cron will refuse to load a crontab that has group/others write privileges, and when you load it via a volume it get 0664
This can be fixed by including the /etc/crontab during the build and using a RUN step to force the 0644 perms, or just forcing the perms in the entrypoint just before call to start the cron daemon.
Same issue for me when using FROM ubuntu:22.04. Instead of using a volume in the run command, I added this to the Dockerfile:
COPY crontab /etc/crontab
RUN chmod 644 /etc/crontab
strange, I just confirmed this was working a week ago (while making other updates). What version of docker are you running?