Here is my Dockerfile (or at least the interesting part):
FROM debian:7
MAINTAINER pjb <[email protected]>
RUN apt-get update && apt-get install -y build-essential ntp cron
ADD config/job /etc/cron.d/job
ADD config/cron /etc/default/cron
RUN chmod 0644 /etc/cron.d/job
CMD cron && tail -f /var/log/cron.log
I use this command to run the container:
docker run -d --restart=always -e "TZ=Europe/Paris" -v /etc/timezone:/etc/timezone:ro --name=mycontainer pjb/repo
When I enter the container (docker exec -it mycontainer bash
) all looks good to me:
/etc/cron.d/job:
* * * * * root /bin/date >> /var/log/cron.log 2>&1
/etc/default/cron:
READ_ENV="yes"
TZ="Europe/Paris"
/etc/timezone:
Europe/Paris
And /bin/date
gives me the correct time.
But the date I get inside /var/log/cron.log is UTC time. It should be UTC+1.