Simple scheduling for short-running Docker containers https://blog.iamthefij.com/2018/11/19/introducing-dockron-scheduling/
Go to file
Ian Fijolek df8be80692
Some checks failed
the build failed
Add more debug info
2018-11-21 14:58:13 -08:00
.drone.yml Add more debug info 2018-11-21 14:58:13 -08:00
.gitignore Rename binary 2018-08-03 19:27:49 -07:00
Dockerfile Switch to busybox 2018-08-12 14:19:23 -07:00
Gopkg.lock Add Makefile and dependency management 2018-08-02 18:55:45 -07:00
Gopkg.toml Add Makefile and dependency management 2018-08-02 18:55:45 -07:00
LICENSE Initial commit 2018-08-01 15:54:55 +00:00
main.go Remove tick log because it's kinda pointless 2018-08-03 17:48:23 -07:00
Makefile Rename binary 2018-08-03 19:27:49 -07:00
README.md Come up with a name and watch flag 2018-08-03 17:45:53 -07:00

Dockron

A Dead Simple Docker Cron Scheduler

Usage

Dockron requires access to the Docker, so it may need to be run as root, or, if in a Docker container, need the socket mapped as a volume.

Running Dockron

As simple as:

dockron

It will then run in the foreground, periodically checking Docker for containers with labels containing a cron schedule.

By default, Dockron will periodically poll Docker for new containers or schedule changes every minute. You can specify an interval by using the -watch flag.

Scheduling a container

First, be sure your container is something that is not long running and will actually exit when complete. This is for batch runs and not keeping a service running. Docker should be able to do that on it's own with a restart policy.

Create your container and add a label in the form dockron.schedule="* * * * *", where the value is a valid cron expression (See the section Cron Expression Formatting).

Dockron will now start that container peridically on the schedule.

Cron Expression Formatting

For more information on the cron expression parsing, see the docs for robfig/cron.

Caveats

Dockron is quite simple right now. It does not yet:

  • Issue any retries
  • Cancel hanging jobs

I intend to keep it simple as well. It will likely never:

  • Provide any kind of alerting (check out Minitor)
  • Handle job dependencies

Either use a separate tool in conjunction with Dockron, or use a more robust scheduler like Tron, or Chronos.