16

here is the thing: I have a stack where a node js backend sends messages to a queue and perl workers (cron jobs) consume messages from that queue. I already "dockerized" the node js backend but now I'm trying to do the same with the Perl Workers.

Already dockerized the Perl application itself however, as the "jobs" from the queue are consumed based on a crontab (i.e every 2 mins) my question would be:

What's the best way to accomplish this when having a stack built from a docker-compose file?

Let me know if I should provide more details. Thanks!

1

1 Answer 1

9

I got it solved with the help of How to run a cron job inside a docker container? however, I had to add the line:

RUN crontab /etc/cron.d/crontab

which basically Loads the crontab data from the specified file. If i did not do it that way, the cron daemon never starts.

Hope this helps however, still not clear if this is the best way to do this.

Sign up to request clarification or add additional context in comments.

1 Comment

Please take into consideration invoking cron outside container (like in k8s) when scaling application. Cron jobs might overlap when containers are scaled.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.