I have setup a cron inside a docker php:8.1.0-fpm-buster
. It's running like expected, but there is no log showing up inside the docker desktop, it's a black screen.
Here is the docker file
FROM php:8.1.0-fpm-buster
ARG ENV
RUN apt-get update && apt-get -y install cron
RUN touch /var/log/cron.log
RUN chmod 777 /var/log/cron.log
COPY ./crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
RUN /usr/bin/crontab /etc/cron.d/crontab
CMD [ "cron", "-f", "-L", "2" ]
What I was expecting inside the logs was something similar to linux logs of cron, like this example:
Jan 20 09:32:01 ns555555 CRON[21051]: (root) CMD (echo 'my command')
I tried differents commands:
- I added
bash -c
before the cron command - I remove the
-L 2
I have also found other stackoverflow posts, but eachtime it's not the same cron:
- See cron output via docker logs, without using an extra file
- Docker - Using PHP Cli base image for Cron container
What am I doing wrong ? Did I install the wrong cron ?