Syncing clock with host

Better clock sync was introduced in Beta 13. Do you still need to do this in order to see (semi-)accurate timekeeping?

It’s still the same regarding this particular issue, unless this wasn’t changed at all and timezones must be dealt with separately:

❯ docker run --rm alpine date
Thu May 26 22:11:18 UTC 2016

~
❯ date
Thu May 26 23:11:18 WEST 2016

1 Like

The behavior regarding timezones should be the same as Docker on Linux: the timezone in the container is set to UTC.

Time sync does seem to be much better in beta 13. I have yet to need to run the command above. Thanks! – Adam

I also confirm an improved time syncing in beta 13. Thank you!

running beta 16 here.
With a long postgresql container thats been running over a few suspend resume cycles:
docker exec -it chai-postgres date
Wed Jun 22 01:00:42 UTC 2016
host system date
date
Thu 23 Jun 2016 11:25:29 BST
Restarting docker fixed it but don’t want to have to do that each time

1 Like

Also running beta 16 on el capitan. Myself and everyone else in my shop gets dramatic clock skew after mac sleeping using largely ubuntu 14.04 stock containers.

3 Likes

I see clock skew errors again intermittently after sleep in a centos 6.7 container.

2 Likes

I am having the same issue when my Mac was sleeping. Restarting Docker from the menu bar item temporarily solves the issue.

To test this I use this command:

docker run --rm ubuntu date -u && date -u

appears to be a windows problem too

I’m running the latest beta and just realized I had 6 minutes of clock skew - my AWS api calls were failing from the container.

1 Like

I use Docker for Mac for running builds and testing, this issue makes make very unhappy and timestamps on build artefacts get me very confused at times. Timezone arithmetics are bad enough, clock drift arithmetics are a pure joy!

Yeah this is seriously annoying. On OS X 10.12 after some sleeping the host shows:

% date
Tue Oct 25 10:21:46 MDT 2016

While a random container is showing:

# date
Tue Oct 25 16:04:57 UTC 2016

I’m also seeing significant clock drift in my Alpine containers on OSX 10.12. This should be treated as a serious bug - lots of things depend on the clock being correct!

I just added time syncing to the Mac host on the d4m-nfs project, https://github.com/IFSight/d4m-nfs which is intended to get over the slow file access of Docker for Mac current implementation of osxfs.

Still seeing this with Docker for Mac Version 1.12.3-beta29.3 (13640)

Issue still exists on Docker For Mac Version 1.12.3 (13776)

Has anyone here created a bug to track this issue? If so, where is it / has anyone identified the specific project at fault?

Yes, there’s a Github issue: https://github.com/docker/for-mac/issues/17

1 Like

To set the clock I did,

docker run --privileged --rm alpine date -s "$(date -u "+%Y-%m-%d %H:%M:%S")"

This prints the Mac’s time in UTC so that it matches UTC in the container.

1 Like