Coder Social home page Coder Social logo

docker-cron's Introduction

Docker-Cron

Container to run other containers as cron jobs.

Usage

The following command will spawn a container named testCronAbc every minute.
The testCronAbc container will print the value of the environment variable AAA, 123 in this case.

cat > gen_env_file <<EOL
TASK_SCHEDULE=* * * * *
COPY_ENV_VARS=AAA,BBB
AAA=123
BBB=456
EOL

cat > gen_containerInfo.json <<EOL
{
    "Image": "ubuntu:latest",
    "Name": "testCronAbc",
    "Cmd": [
        "printenv",
        "AAA"
    ]
}
EOL

docker run --rm -d --name docker-cron                         \
  -v /var/run/docker.sock:/var/run/docker.sock                \
  -v $PWD/gen_containerInfo.json:/usr/src/containerInfo.json  \
  --env-file gen_env_file                                     \
  camilin87/docker-cron

Configuration

The cron container behavior can be tweaked with the following environment variables

# whether to display verbose logging
DOCKER_CRON_DEBUG_LOG_ENABLED=1
# the cron schedule
TASK_SCHEDULE=* * * * *
# comma-separated list of the variables
# that need to be trickled down to the spawned containers
COPY_ENV_VARS=VAR1,VAR2

Dev Resources

Development Readme

Useful Links

docker-cron's People

Contributors

cshtdd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kaanuki yellowdog

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.