Skip to content

Showcases how to use a docker container to run a cron job every 1 minute to run a python script and do some timestamp logging as well.

License

Notifications You must be signed in to change notification settings

jmarrec/docker-cron-timestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker cron with timestamp

Docker Test Cron CI

Showcases how to use a docker container to run a cron job every 1 minute to run a python script and do some timestamp logging as well.

All timestamps in UTC (default docker timezone).

Usage:

There is a Github Actions workflow docker-cron-test.yml that shows it in action (Note: I have to pass -i only and not -it to docker run because GHA runners aren't TTY devices).

Locally, you can do:

docker image build -t test/cron .
docker run -it --name cron --rm test/cron

Sample output:

[2021-08-10T12:15+0000] Running run.py
[2021-08-10T12:15:01.381150+00:00] Python: inside run.py
[2021-08-10T12:15+0000] Done running run.py
[2021-08-10T12:16+0000] Running run.py
[2021-08-10T12:16:01.405802+00:00] Python: inside run.py
[2021-08-10T12:16+0000] Done running run.py

About

Showcases how to use a docker container to run a cron job every 1 minute to run a python script and do some timestamp logging as well.

Topics

Resources

License

Stars

Watchers

Forks

Packages