如何在Docker中运行cronjob,以及如何查看结果?

目前,我尝试在容器Docker中运行cronjob,但是我看不到任何结果。 我的Dockerfile看起来像这样:

# Pull base image. FROM ubuntu # Upgrade system RUN apt-get update && apt-get dist-upgrade -y --no-install-recommends # INSTALL GIT RUN apt-get install -y git-core # INSTALL mysql-client RUN apt-get install -y mysql-client #INSTALL CRON RUN apt-get install cron # INSTALL NANO RUN apt-get install -y nano # INSTALL SUPERVISOR RUN apt-get install -y supervisor ADD /supervisor/supervisor_watch_.conf /etc/supervisor/conf.d/watch_.conf # Add these lines to your own Dockerfile ADD /script/crontab /etc/crontab ADD /script/start-cron.sh /usr/bin/start-cron.sh RUN touch /var/log/cron.log #ADD scrapyTor scrapy CMD /usr/bin/supervisord -n 

我的supervisor_watch_.conf看起来像这样:

 [program:cron] command=cron -f -L 15 autostart=true autorestart=true startretries=0 stderr_logfile=/tmp/start_spider.err.log [program:tor] command=/usr/bin/tor #command=/tmp/mytor.sh autostart=true autorestart=true redirect_stderr=true stdout_logfile=/tmp/start_spider.out.log 

和我的crontab ,只是这样的:

 * * * * * root echo "toto" >> /var/log/cron.log 2>&1 

在build立我的图像( docker build -t toto )并运行我的容器( docker run -d toto )之后,当我想用​​这个命令( docker exec -it ID )看到我的容器内的结果时, /var/log/cron.log ….

怎么样,我可以解决这个问题?

提前致谢。