Crontabs not working, not able to find MY error

Hello everybody,

first of all: I’m new to Docker, still learning and reading, so please don’t shoot me on my first question. I’m sure the error is sitting in front of the computer.

I’m running some VMs which are idling most of the time. Now I want to learn something about docker to get rid of my VMs and define some containers.

During some “self created” learning exercises I’m sturggeling with my very basic cron setup.

Maybe you can help me to find my error:


#Dockerfile
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -yq install cron
COPY scripts/cmd.txt /home/cmd.sh
RUN chmod 0744 /home/cmd.sh
COPY scripts/cron.txt /etc/cron.d/test-cron
RUN chmod 0644 /etc/cron.d/test-cron

RUN crontab /etc/cron.d/test-cron
RUN touch /var/log/cron.log
CMD cron && tail -f /var/log/cron.log

#cron.txt
* * * * * /home/cmd.sh >> /var/log/cron.log 2>&1

#cmd.txt
echo "test" >> /var/log/cron.log

From my understanding /var/log/cron.log should get some content :slight_smile: It get’s filled by executing /home/cmd.sh manually but it’s not executed by cron itself.

Does anybody of you have an idea where my error is?

Many thanks and kind regards
Itchy2