Skip to content

Latest commit

 

History

History
69 lines (43 loc) · 2.23 KB

README.md

File metadata and controls

69 lines (43 loc) · 2.23 KB

Cron daemon Docker image

Docker Cloud Build Status

This image contains a crond. You can set jobs via environment variables.

Usage

This project provides container images on Docker Hub .

$ docker pull blue271828/crond

Environment variables

When you launch the image, you can configure some options.

Variable Default Description
TZ UTC Change the time zone in the container.
Refer to List of tz database time zones If you set an arbitrary time zone.
LOG_LEVEL 8 Set log level for crond.
This corresponds to crond -l option.
LOG_FILE - Set a log file for crond.
This corresponds to crond -L option.
CRONTAB - Set crontab settings.
If you set this variable. User's crontab file is overwritten on launch.
CRONTAB_FILE - Set crontab settings by file.
This file is ignored if you set CRONTAB env.

Example

A container will output “hello crond!” every minute when you type the following command.

$ docker run -it -e CRONTAB='* * * * * echo "hello crond!"' blue271828/crond

If you want to run with Docker Compose, the compose file looks like below.

version: '3'
services:
  crond:
    image: blue271828/crond
    environment:
      TZ: Asia/Tokyo
      LOG_LEVEL: 1
      LOG_FILE: /var/log/crond/crond.log
      CRONTAB: |
        * * * * * echo "hello crond!"
        * * * * * date
    volumes:
      - ./crond:/var/log/crond

Testing

You can test manually with the below command. This project is using dgoss (dgoss is docker wrapper around Goss) for testing. Before deploying a new docker image to Docker Hub, Automated builds kicks this testing script.

$ docker-compose -f docker-compose.test.yml run sut