Docker client + crontab + make + bash Allows to execute scheduled tasks inside other containers by passing access to docker socket.
-
Put your crontab file to the
/root/cron
by mounting a volume or by adding a file to the container.Example crontab file:
15 3 * * * cd /var/project && make task_clear_cache
-
Run the container granting access to the docker socket
sudo docker run --rm --name cron -v /var/run/docker.sock:/var/run/docker.sock -v ./cron:/root/cron wolnosciowiec/docker-cron:latest
-
That's all!