【发布时间】:2018-06-04 06:34:23
【问题描述】:
我正在尝试在我的 Docker 映像中运行 cron 作业。当我使用这个Dockerfile
FROM ubuntu:latest
# Install cron
RUN apt-get update
RUN apt-get install cron
# Add crontab file in the cron directory
ADD crontab /etc/cron.d/simple-cron
# Add shell script and grant execution rights
ADD script.sh /script.sh
RUN chmod +x /script.sh
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/simple-cron
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD cron && tail -f /var/log/cron.log
然后它工作正常。如果我将FROM 更改为
FROM eventstore/eventstore,然后我的 cronjob 停止工作。 eventstore 是基于 ubuntu:1604 的,所以它似乎应该继续工作。有人有什么想法吗?
【问题讨论】: