Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time isn't synced between machine and docker #693

Closed
ghost opened this issue Sep 23, 2016 · 9 comments
Closed

Time isn't synced between machine and docker #693

ghost opened this issue Sep 23, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2016

Expected behavior

Time should be synced between machine and docker container

Actual behavior

Time isn't synced between machine and docker container

Information

  • Docker for Mac: version: 1.12.1
  • OS X: version 10.12

Steps to reproduce the behavior

  1. Start with mounting localtime as a volume /etc/localtime:/etc/localtime:ro
  2. use date on your local machine and your docker running container
  3. Time is different
@ghost
Copy link
Author

ghost commented Sep 23, 2016

Seems a restart fixed the issue.

@slot
Copy link

slot commented Sep 30, 2016

My colleague @ashishbagri7 and I had the same issue, after restart of docker itself the time is synced. I suspect it has to do with hibernation of the Mac itself. I'll try to reproduce.

Diag ID FB729667-58C7-452F-92E0-C68BBBCD51C4

@mauritsl
Copy link

I had the same issue, originally posted in Docker issue queue:
moby/moby#27488

A restart also fixes the problem for me.

@mauritsl
Copy link

mauritsl commented Oct 20, 2016

Time is not synced to docker because timezone is not synced on Mac automatically, according to this issue: moby/moby#27488

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 nlams2-ntp-001. .GPSs.           1 u  57m  256  100   13.581  -27830.  16.63

However, checkbox "Set date and time automatically" is checked in the Date & Time settings on MacOS and synced with "Apple Americas/U.S. (time.apple.com.)" (running El Capitan).

I can reproduce this behavior consistently. Yesterday morning I restarted Docker. Time in container was identical to time on host machine, and was still identical at the end of the workday (did not hibernate my Mac in the meanwhile). Mac was hibernated in the evening and tonight. Clock is now over 13 hours behind.

$ date;docker run -it --rm -e TZ=Europe/Amsterdam ubuntu:16.04 date
Thu Oct 20 11:07:08 CEST 2016
Wed Oct 19 21:31:01 CEST 2016
$ docker -v
Docker version 1.12.1, build 6f9534c

@jaggerwang
Copy link

meet the same problem, both mac os and docker is the newest.

@justincormack
Copy link
Member

@mauritsl there is no * on your ntpq -p output which means it is not synced, at which point it will not sync with the VM. Your offset is quite a way off. This seems somewhat common, but we don't know why...

Should look like:

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*nlams2-ntp-002. .GPSs.           1 u  362   64   40  148.735   65.509 207.916

@ijc
Copy link
Contributor

ijc commented Oct 27, 2016

there is no * on your ntpq -p output which means it is not synced

The "If your system does not have access to an NTP server" paragraph near the end of https://docs.docker.com/docker-for-mac/troubleshoot/ contains a possible workaround for this sort of thing (namely adding the local clock as a low priority NTP source).

@ijc
Copy link
Contributor

ijc commented Nov 15, 2016

Closing as a duplicate of #17

@ijc ijc closed this as completed Nov 15, 2016
rowi1de added a commit to rowi1de/jwtdummy that referenced this issue Mar 16, 2018
Allow issued_at Header Parameter. 
This is a workaround, when using in docker (docker/for-mac#693)
@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants