Hello,
First, if i’m not in the good category, please tell me because I don’t know where to post.
My problem is : how to create a cron task in the php:7.2.2-apache container ?
Here is my Dockerfile :
FROM php:7.2.2-apache
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN apt-get update && apt-get install -y cron
COPY data/ /var/www/html/
RUN chown -R :www-data /var/www && chmod -R 777 /var/www/
RUN chmod +x /var/www/html/crons/cronInit.sh
ENTRYPOINT [ "/var/www/html/crons/cronInit.sh" ]
cronInut.sh :
#!/bin/bash
chmod +x /var/www/html/crons/cron
crontab /var/www/html/crons/cron
service cron reload
service cron restart
chmod +x /var/www/html/crons/cron.php
cron -f &
docker-php-entrypoint apache2 -D FOREGROUND
It does’nt work but only running the container with copying my “data” folder in allow me to access to my app normally (but the cron is not working)
Thanks for help