'How can I add cron jobs in docker image
FROM python:3.10.2
WORKDIR /usr/src/app
COPY ./requirements.txt .
RUN pip install -r requirements.txt
RUN apt-get update && apt-get install -y cron curl
EXPOSE 8084
COPY . .
CMD ["flask", "run", "--host", "0.0.0.0"]
just a function to test
@crontab.job(minute='*')
def writeones():
with open('t.txt', 'a') as file:
file.write("Now the file has more content!")
But after command docker-compose up I type flask crontab add and its output:
no crontab for root
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
