for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Wrong Date/Time

Open devlife opened this issue 10 years ago • 52 comments

Expected behavior

I would expect the container date and time would match host date and time

Actual behavior

The container is a day+ behind my windows host

Information

Steps to reproduce the behavior

  1. docker run... for ubuntu:latest
  2. date from within the container
  3. Note that the date/time is different than your windows host

devlife avatar Sep 06 '16 14:09 devlife

@devlife thanks for the report. We use the in kernel Hyper-V time synchronisation and it should work, but may only gradually adjust time. A couple of questions:

  • did this happen after your computer was set to sleep?
  • did you check the time soon after waking up after sleep?
  • did the gap get less over time?

rn avatar Sep 06 '16 22:09 rn

This is happening to me as well, since last update

antoniocanas avatar Sep 09 '16 09:09 antoniocanas

Same problem happening to me. The clock drift corresponded exactly to the time my laptop was in sleep mode. I didn't realize it immediately, but I started to see wrong behaviors in my Docker applications (ELK stack reporting logs with a time difference) just after resuming.

cvillerm avatar Sep 09 '16 12:09 cvillerm

@rneugeba My computer was not set to sleep. I'll set my computer to sleep and check the time and see if the gap has lessened.

devlife avatar Sep 09 '16 12:09 devlife

Disabling and then enabling again the MobyLinuxVM > Settings > Integration Services > Time synchronization service from Hyper-V Manager resyncs the clock of containers immediately.

cvillerm avatar Sep 09 '16 15:09 cvillerm

Unfortunately I have issues with this as well. I'm using docker for windows mainly as some build/cross-compilation tool, by running a build scripts inside linux containers. This problems e.g. leads to automake failing:

checking whether build environment is sane... configure: error: newly created file is older than distributed files!

Always happens if the PC is going to sleep (e.g. during lunch time). Does not recover until I manually restart docker, so I think it's not really syncing during runtime but only at startup. The workaround from @cvillerm helps to recover without a docker restart.

Matthias247 avatar Sep 28 '16 11:09 Matthias247

My symptom was that on every change vim would say "WARNING File has changed since last read!". Took me ages to figure out it was a time problem.

This was not happening 2 or 3 updates ago, even with regular laptop sleep/hibernation.

rlpowell avatar Sep 29 '16 15:09 rlpowell

also ran into that problem while running terraform within a container to create an infrastructure on azure. creating a storage account failed with an authorization problem. cvillerms Tipp helped

schwamster avatar Oct 05 '16 18:10 schwamster

For me, resuming from hibernate leaves the docker clock at the same time it was hibernated at. Restarting docker fixes the timestamp, but also means restarting containers...

cfstras avatar Oct 18 '16 15:10 cfstras

same issue here, exactly as reported by @cfstras . Annoying thing for me is one of the containers is running keycloak and after the laptop sleeps, it issues OIDC certificates with an outdated timstamp so all my authentication chain is broken.

I would rather have docker stop all my containers after a sleep, at least I would know I have to restart everything.

entzik avatar Oct 20 '16 10:10 entzik

Add me to the list. Using make inside Moby with time drift is impossible, so much so that I've resorted to building my containers on a remote box instead.

rcarmo avatar Oct 24 '16 14:10 rcarmo

@rneugeba

  • did this happen after your computer was set to sleep? Yes
  • did you check the time soon after waking up after sleep? Yes, correction is either not happening or not happening quickly enough. -- Needs to be immediate
  • did the gap get less over time? Not sure, will look into this aspect

Using Docker GUI to Restart Docker appears fix it immediately every time. Though there has got to be a more elegant solution.

zifik avatar Oct 25 '16 15:10 zifik

Any update/priority on this issue?

provegard avatar Nov 15 '16 12:11 provegard

Hi everyone, a fix should ship in the next Beta version (Beta31), scheduled next week.

dgageot avatar Nov 21 '16 16:11 dgageot

@devlife @cvillerm @Matthias247 @cfstras @provegard @zifik @rcarmo Beta 31 was just released. It's expected to fix this issue. Please give it a try!

dgageot avatar Dec 01 '16 05:12 dgageot

Docker version 1.13.0-rc2-beta31 (9132) de6f6c2

  • Working with docker, all good
  • Hibernate PC in the evening
  • Wake up
[inside container]
# date
Wed Nov 30 21:34:24 UTC 2016
## go to hyper-v manager, disable and enable Time Sync integration
# date
Thu Dec  1 09:56:05 UTC 2016

So the issue is still there. Do I maybe have to recreate my docker machine to get the fix in? Because I'd rather not go through the process of backing up development containers.

cfstras avatar Dec 01 '16 10:12 cfstras

@cfstras The Disable/Enable should have be done automatically. Can you share your logs?

dgageot avatar Dec 01 '16 10:12 dgageot

Sure. before hibernate: (log.1.txt) http://pastebin.com/egk8bhzq after hibernate: (log.txt) http://pastebin.com/ZUw2efY9

cfstras avatar Dec 01 '16 11:12 cfstras

@dgageot Thanks for working on it. Just tested with beta31 but still experience the same problem after PC went to sleep after the amount of time that was set in the windows power options (power plan) settings.

Matthias247 avatar Dec 01 '16 12:12 Matthias247

Same here:

rlpowell@680e70564cca> date Thu Dec 1 01:22:37 PST 2016 rlpowell@680e70564cca> date Thu Dec 1 08:48:11 PST 2016

I'll note that the list of integration services looks different; "Data Exchange" and "Backup" are now unchecked. Maybe your code is toggling the wrong thing depending on versions of hyper-v, or something like that?

rlpowell avatar Dec 01 '16 16:12 rlpowell