Skip to content

SoftwareCraftsmen/docker-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

This implementation is based on cron

Prepare a docker host

docker-machine create --driver virtualbox default <1>
docker-machine start default <2>
eval `docker-machine env default` <3>
  1. Create a docker machine (once only)
  2. Start the docker machine
  3. Setup the docker client to use the docker-machine

Build cron

docker build -t softwarecraftsmen/cron .

Extend and run cron

The cron base container only provides the scaffolding for cron jobs. In order to implement a cron job it must be extended and a job schedule has to be added.

The demo folder is containing a sample Dockerfile and docker-compose script to demonstrate the use of the base image.

FROM softwarecraftsmen/cron
MAINTAINER Software Craftsmen GmbH und CoKG <[email protected]>
ADD cron-setup.sh cron-setup.sh
RUN chmod +x cron-setup.sh

cron-setup.sh

#!/usr/bin/env bash
echo  "* * * * * root echo hello >> $CRON_LOG 2>&1" >> /etc/cron.d/docker-cron
chmod 0644 /etc/cron.d/docker-cron

To fire up the cron scheduler run the docker-compose script.

docker-compose --project-name=docker-cron-demo up 

About

A minimalistic base image for cron scheduling

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages