gocron

automationdevops

Minimal Go-based task scheduler configured entirely through a YAML file. Define cron jobs as Docker commands, shell scripts, or HTTP requests and run them on a schedule with no web UI overhead

#cron#scheduler#go#yaml#docker#self-hosted

Quick Start

docker run -d -v ./gocron.yaml:/app/config.yaml -v /var/run/docker.sock:/var/run/docker.sock flohoss/gocron:latest

Overview

gocron is a lightweight task scheduler written in Go. All jobs are defined in a single YAML configuration file — cron expression, command type, and parameters — and the binary runs them on schedule. There is no database, no web interface, and no admin panel to configure. For Docker-based environments where you want scheduled tasks without the overhead of a full scheduling platform, it covers the essentials with minimal footprint.

The YAML configuration makes gocron a natural fit for infrastructure-as-code workflows. Job definitions live alongside your Docker Compose files, are visible to anyone reading the repository, and can be reviewed in pull requests like any other configuration. The format is simple enough that a crontab user can read it without a guide.

Three job types cover most scheduling scenarios. Docker commands run a container image on a schedule — useful for database backups, cleanup scripts, and one-shot processing jobs. Shell commands execute scripts on the host or within the container’s environment. HTTP calls hit a webhook endpoint, which handles cases where the actual work happens in another service.

The tool’s limitations are the direct result of its design goals. There is no web UI, so you cannot visually inspect what jobs have run, trigger a job manually, or see a timeline of executions. Log output is the only visibility mechanism. There is no retry logic, no alerting on failure, and no dependency tracking between jobs.

For simple self-hosted environments — a VPS running a handful of Docker services that need a regular backup or cleanup job — gocron is clean and unobtrusive. For more complex scheduling requirements with visibility, retry handling, or job dependencies, Dagu or Cronicle are better-matched options.

Use Cases

Specific ways to use gocron for your workflow.

01
Replace scattered crontab entries across Docker containers with a single YAML file that defines all scheduled tasks in one place
02
Run database backups, log rotation, and health checks on a schedule without maintaining a separate cron container per service
03
Schedule Docker container runs (one-shot jobs) from a lightweight sidecar without a full job scheduling platform
04
Define recurring HTTP calls to webhook endpoints on a cron schedule without a full automation platform

Deployment Strategy

Recommended ways to host gocron in your own environment.

docker
self-hosted