Jump to content

Docker ( php/nginx ), cron task.php


Recommended Posts

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 )

Link to comment
Share on other sites

  • 2 years later...

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 🙂

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...