# Scheduling recurring, cron-like tasks using containers?

**URL:** <https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555>\
**Category:** Rancher 1.x\
**Created:** [September 24, 2015, 9:05pm UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555 "2015-09-24T21:05:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alejom99](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/alejom99/32/281_2.png) [@alejom99](https://forums.suse.com/u/alejom99)\
**Post date:** [September 24, 2015, 9:05pm UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/1 "2015-09-24T21:05:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ebishop](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ebishop](https://forums.suse.com/u/ebishop)\
**Post date:** [September 25, 2015, 11:33am UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/2 "2015-09-25T11:33:36Z")

</div>

I was going to just +1 this post, but I needed 20 characters. 😐  
This would be a nice feature!

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [September 25, 2015, 12:21pm UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/3 "2015-09-25T12:21:13Z")

</div>

I think the +1 feature is symbolized with a heart on this forum… 😉

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [September 25, 2015, 4:11pm UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/4 "2015-09-25T16:11:16Z")

</div>

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. 🙂

> <https://github.com/rancher/rancher/issues/2143>
>
> Per http://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555
> Create ability to schedule containers through Rancher

---

<div class="post-metadata">

**Author:** ![smazurov](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/smazurov/32/1395_2.png) [@smazurov](https://forums.suse.com/u/smazurov)\
**Post date:** [June 2, 2016, 10:46pm UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/5 "2016-06-02T22:46:54Z")

</div>

I posted this in the GH issue, but I figured some people on the forums might not see it

I created a [service](https://github.com/SocialEngine/rancher-cron) that can start containers on a schedule. Its pretty easy to get going.

First, launch it using this `docker-compose.yml`:

```auto
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:

```auto
your-cron-service:
  labels:
    io.rancher.container.start_once: 'true'
    com.socialengine.rancher-cron.schedule: '@every 10m'
  image: your-cron-image

```

Then, [`rancher-cron`](https://github.com/SocialEngine/rancher-cron) service will use rancher metadata to find the schedule, and will launch `your-cron-service` container every 10 minutes.

---

<div class="post-metadata">

**Author:** ![meggar](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/meggar/32/2853_2.png) [@meggar](https://forums.suse.com/u/meggar)\
**Post date:** [March 2, 2018, 3:23am UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/6 "2018-03-02T03:23:31Z")

</div>

Is this available for K8s env ? I assume it should be, but I see it in the catalog as “Not Compatible”…

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [March 2, 2018, 3:26am UTC](https://forums.suse.com/t/scheduling-recurring-cron-like-tasks-using-containers/555/7 "2018-03-02T03:26:15Z")

</div>

No; k8s has its own cronjob controller… [https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/)
