Docker Container: time/timezone wrong
root@foobar:~# node -e "console.log(new Date())" >> Tue May 17 2016 15:12:43 GMT+0200 (CEST) root@foobar:~# docker exec 9179105c0ff9 node -e "console.log(new Date())" >> Tue May 17 2016 13:13:01 GMT+0000 (Europe) root@foobar:~# cat /etc/timezone >> Europe/Vienna root@foobar:~# docker exec 9179105c0ff9 cat /etc/timezone >> Europe/Vienna
So what I already did in my docker-start shell is script is the following:
docker run \ ... -v /etc/localtime:/etc/localtime:ro \ -v /etc/timezone:/etc/timezone:ro \ -e "TZ=Europe/Vienna" \ ...
… but still, as you can see in the first codeblock, the time is still wrong! Any ideas on this? What am I missing?
(fyi: I am running a meteor app deployed via mupx)
date on the host and inside the container, there again is a difference of 2hrs. so for some reason the docker container just does not “apply” my timezone and it seems like the problem is not JS/node related, since
dateis just a simple unix system cmd … what am I missing here?!
One Solution collect form web for “Docker Container: time/timezone wrong”
>> Tue May 17 2016 15:12:43 GMT+0200 (CEST)
>> Tue May 17 2016 13:13:01 GMT+0000 (Europe)
are approximately the same time(around 18sec difference, because you didn’t ran the commands at the same time).
Take a closer look, it’s around 3pm GMT+0200 and around 1pm GMT+0000.
This is just a difference in output format, but the time is the same.
If you execute
.getTime() on the value of the
new Date(), you will probably have the same values.
This is probably due to differences in default output format in different node.js versions.