Mihoko Okayami Posted February 19, 2019 Posted February 19, 2019 Hello, In a Docker environment with a container for php, another for nginx redis etc,I can not configure cron jobs ... I use cron from the host server (not in a container) : * * * * * docker exec -it php /bin/ash -c "/usr/local/bin/php -d memory_limit=-1 -d max_execution_time=0 /webstack/itomori/htdocs/www/applications/core/interface/task/task.php my_ips_task_key" When I run the command manually, it works, but not via crontab. I can not find anything in the logs too. Someone would have any idea ? ( My PHP container always has the name "php" =>container_name: php )
Jonas Erlandsson Posted October 4, 2021 Posted October 4, 2021 If you put the cron jobs you want in a file with your sources you can do: COPY /host/path/to/cron.conf /some/path/in/docker/container/cron.conf Then you can do RUN crontab /some/path/in/docker/container/cron.conf That will import your cron config to your crontab. You can double check this by running contab -e inside your container. I know it's a "bit" late, but hope it helps 🙂
Recommended Posts