docker-cron icon indicating copy to clipboard operation
docker-cron copied to clipboard

Ubuntu: /etc/crontab must be 0644 or will not work [it does not work in your way]

Open stdevPavelmc opened this issue 2 years ago • 2 comments

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.

stdevPavelmc avatar May 31 '23 07:05 stdevPavelmc

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

chrisequalsdev avatar Nov 02 '23 21:11 chrisequalsdev

strange, I just confirmed this was working a week ago (while making other updates). What version of docker are you running?

AnalogJ avatar Apr 19 '24 22:04 AnalogJ