Skip to content

Instantly share code, notes, and snippets.

@sebastian13
Last active April 29, 2018 09:15
Show Gist options
  • Save sebastian13/eb417961e7cda46ab27ce4a69182b8bd to your computer and use it in GitHub Desktop.
Save sebastian13/eb417961e7cda46ab27ce4a69182b8bd to your computer and use it in GitHub Desktop.

Container-Crontab

Rancher's container-crontab acts as a crontab for other containers.

Start the cron-container

version: '3'

services:
  crontab:
    image: rancher/container-crontab:v0.5.0
    container_name: crontab
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Define a schedule

By adding the label cron.schedule to a docker-compose.yml file while starting the container, the crontab will start the respective container in the defined schedules or intervals.

labels:
  cron.schedule: "0 0 1 * * MON"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment