When I run a docker container on my PC it has a totally different date/time to the host PC. See commands below. The time on the container recognizerDev is for the previous day, different hour, different minutes to the host. Any idea what is going on?
PS C:\Users\Bobby> date
11 October 2016 19:51:38
PS C:\Users\Bobby> docker exec recognizerDev date
Mon Oct 10 21:43:54 UTC 2016
When I try the same thing running on an AWS linux host the date/time is correct except for a 1 hour difference due to timezones.
Note that the first command returns the correct time/date in UTC+1 (London) as per my PC. The second command says it is in UTC but this cannot be right as if so it would return the same result less 1 hour.
I’ve just reset docker on the PC and the time is now correct though it wasn’t when it had come up automatically at PC boot time. It seems that when it first comes up when I boot the pc it has the wrong time, but if I reset it, it gets the right time. I’ll try to confirm this. Does this make any sense to anybody out there?
The reason for this issue for me was that Docker containers will not synchronize time after the host system hibernates/sleeps and container-datetime will thus lag behind.