Docker Community Forums

Share and learn in the Docker community.

Syncing clock with host

(David Sheets) #4

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

(Rui Marinho) #5

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

(David Sheets) #6

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

(Lyonfnal) #7

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

(Rui Marinho) #8

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

(Mountainpenguin) #9

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
Thu 23 Jun 2016 11:25:29 BST
Restarting docker fixed it but don’t want to have to do that each time

(Ernestmueller) #10

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.

(Lyonfnal) #11

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

Docker for Windows should resync VM time when computer resumes from sleep
(Florian) #12

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

Failure in "make shell" to build development container
(Mountainpenguin) #13

appears to be a windows problem too

(Stephen Augenstein) #14

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.

(Errordeveloper) #15

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!

(andrew morton) #16

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

(Andrewzkeating) #17

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!

(Fulcrum) #18

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

(Brian Dentino) #19

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

(Snky1987) #20

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

(Untoldone) #21

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

(Jliu70) #22

Yes, there’s a Github issue:

(Nathaniel Nutter) #23

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.