Is it possible to schedule containers through Rancher that run on a cron-like schedule? This would be useful for running daily backups and other recurring tasks.
I was going to just +1 this post, but I needed 20 characters.
This would be a nice feature!
I think the +1 feature is symbolized with a heart on this forum…
Even better, create a GitHub issue so more people could +1 your idea and we could put it on our roadmapif enough people want it.
I posted this in the GH issue, but I figured some people on the forums might not see it
I created a service that can start containers on a schedule. Its pretty easy to get going.
First, launch it using this docker-compose.yml
:
rancher-cron:
labels:
io.rancher.container.create_agent: 'true'
io.rancher.container.agent.role: environment
image: socialengine/rancher-cron:0.1.0
Then, have a Start Once container in a service with com.socialengine.rancher-cron.schedule
label:
your-cron-service:
labels:
io.rancher.container.start_once: 'true'
com.socialengine.rancher-cron.schedule: '@every 10m'
image: your-cron-image
Then, rancher-cron
service will use rancher metadata to find the schedule, and will launch your-cron-service
container every 10 minutes.
Is this available for K8s env ? I assume it should be, but I see it in the catalog as “Not Compatible”…
No; k8s has its own cronjob controller… https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/