Simple scheduling for short-running Docker containers https://blog.iamthefij.com/2018/11/19/introducing-dockron-scheduling/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
IamTheFij bb6c7f903a Remove Gopkg.* 1 mês atrás
.drone.yml Fix drone builds building wrong arm64 images 1 mês atrás
.gitignore Add versioning to dockron binary 2 meses atrás
Dockerfile Update entrypoint and update multi-stage builds 1 mês atrás
Dockerfile.multi-stage Update entrypoint and update multi-stage builds 1 mês atrás
LICENSE Initial commit 1 ano atrás
Makefile Update all make targets and Readme for building 1 mês atrás
README.md Update all make targets and Readme for building 1 mês atrás
go.mod Switch to go mod instead of dep 1 mês atrás
go.sum Switch to go mod instead of dep 1 mês atrás
main.go Add versioning to dockron binary 2 meses atrás
manifest.tmpl Add multi-arch builds 3 meses atrás

README.md

Dockron

Simple scheduling for short-running Docker containers

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.

Running with Docker

Dockron is also available as a Docker image. The multi-arch repo can be found at IamTheFij/dockron

From either an amd64, arm, or arm64 machine, you can run Dockron using:

docker run -v /var/run/docker.sock:/var/run/docker.sock:ro iamthefij/dockron -watch

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.

Building

If you have go on your machine, you can simply use make build or make run to build and test Dockron. If you don’t have go but you do have Docker, you can still build docker images using the provide multi-stage Dockerfile! You can kick that off with make docker-staged-build