DockerFile
FROM debian:latest
RUN apt-get update && apt-get install -y cron
COPY cronjobs /etc/cron.d/cronjobs
RUN chmod 0644 /etc/cron.d/cronjobs
RUN touch /var/log/cron.log
CMD cron && tail -f /var/log/cron.log
cronjobs
* * * * * root echo 'cron is running' >> /var/log/cron.log 2>&1
//创建镜像
docker build -t cron-app .