Public | Automated Build

Last pushed: 9 months ago
Short Description
Cron scheduling
Full Description

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 <office@software-craftsmen.at>
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
Docker Pull Command
Owner
softwarecraftsmen
Source Repository