How to run a cron job inside a docker container

Here is how I run one of my cron containers. Dockerfile: FROM alpine:3.3 ADD crontab.txt /crontab.txt ADD script.sh /script.sh COPY entry.sh /entry.sh RUN chmod 755 /script.sh /entry.sh RUN /usr/bin/crontab /crontab.txt CMD [“/entry.sh”] crontab.txt */30 * * * * /script.sh >> /var/log/script.log entry.sh #!/bin/sh # start cron /usr/sbin/crond -f -l 8 script.sh #!/bin/sh # code goes … Read more

Provide time zone to Spring @Scheduled?

It turned out that I could not use the @Scheduled annotation, but I implemented a work-around. In the JavaDoc of the SchedulingConfigurer it is stated that: [SchedulingConfigurer is] Typically used for setting a specific TaskScheduler bean to be used when executing scheduled tasks or for registering scheduled tasks in a programmatic fashion as opposed to … Read more