Skip to content

FedericoBorra/docker-python-cronjob

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-python-cronjob

Run python script as a cron job using Docker

Build Docker

docker build -t python-cron .

Run docker container

docker run -it --rm python-cron

Container console logs

hello world!
Welcome to python cron job
hello world!
Welcome to python cron job
hello world!

Run with modules

If you are trying to run the script that required some module for instance numpy, you might face module not found error.

Code is running Traceback (most recent call last): File "/app/main.py", line 3, in import numpy as np ImportError: No module named numpy

To resolve this, please look into ./cron-numpy/

Inspired from this SO question https://stackoverflow.com/q/67531710/3288890

About

Run python script as a cron job using Docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 83.1%
  • Python 16.9%