4

Suppose we have to run a script every 15 mins with tools that already exist in our app container (e.g. php, node, etc.) What is the best way to do this?

For example:

  1. Run cron within the app container
  2. Run cron as a separate container
  3. Run cron on the host (using docker exec)

UPDATES

Most of the answers to this question seem to only address SYSTEM crons which are installed either in /etc/cron.d/ or /etc/crontab on the Ubuntu 16.04 base image however I'm more interested in USER crons which normally reside in /var/spool/cron/crontabs for ALL users crons or I believe in /home/user/crontab(not too sure)

I am running my container as a non-root user and need to be able to do RUN crontab myCrontab and have myCrontab under that non-root user within my container and NOT the usual system path listed earlier above.

Hope that's clearer and not identified as a duplicate of the other popular question.

Any ideas ?

pelican
  • 5,846
  • 9
  • 43
  • 67
  • I think the second option is generally the best. Check out [my answer](https://stackoverflow.com/a/75353647/52499). – x-yuri Feb 05 '23 at 16:26

0 Answers0