# Syncing clock with host

**URL:** <https://forums.docker.com/t/syncing-clock-with-host/10432>\
**Category:** Docker Desktop\
**Tags:** macos\
**Created:** [April 28, 2016, 10:09pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432 "2016-04-28T22:09:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruimarinho](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ruimarinho/32/8188_2.png) [@ruimarinho](https://forums.docker.com/u/ruimarinho)\
**Post date:** [April 28, 2016, 10:09pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/1 "2016-04-28T22:09:57Z")

</div>

Would it be possible to sync the host’s clock with the VM one?

Host: Thu Apr 28 23:07:55 WEST 2016  
VM: Thu Apr 28 22:07:55 UTC 2016

---

<div class="post-metadata">

**Author:** ![ionrock](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ionrock/32/9561_2.png) [@ionrock](https://forums.docker.com/u/ionrock)\
**Post date:** [May 9, 2016, 9:19pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/2 "2016-05-09T21:19:31Z")

</div>

I ran into this as well and it caused some problems. Specifically, I was trying to run rndc (bind command line tool) to update a bind slave and the command returned an error code due to the clock skew.

To work around this, I bumped up the ram I wanted allocated to my xhyve docker machine in the from toolbar -\> settings -\> advanced, which restarted the xhyve vm and updated the clock.

I’m curious if there is another way to work around the issue.

---

<div class="post-metadata">

**Author:** ![lyonfnal](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lyonfnal](https://forums.docker.com/u/lyonfnal)\
**Post date:** [May 25, 2016, 8:34pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/3 "2016-05-25T20:34:34Z")

</div>

I find I have this problem too when I wake up my Mac after it was sleeping for a few minutes. This command seems to work (perhaps replace centos:6.7 with ubuntu or a base image you already have - I think any image will work so long as you enter as the root user)

docker run --rm --privileged centos:6.7 date -s “`date`”

(Note the back quotes)

Setting the date/time in any container sets it for the underlying VM, and so all containers see the new time.

Kind of a pain, but it seems to work.

---

<div class="post-metadata">

**Author:** ![dsheets](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dsheets/32/5823_2.png) [@dsheets](https://forums.docker.com/u/dsheets)\
**Post date:** [May 26, 2016, 8:30am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/4 "2016-05-26T08:30:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ruimarinho](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ruimarinho/32/8188_2.png) [@ruimarinho](https://forums.docker.com/u/ruimarinho)\
**Post date:** [May 26, 2016, 10:14pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/5 "2016-05-26T22:14:07Z")

</div>

> [@lyonfnal](#):
>
> docker run --rm --privileged centos:6.7 date -s “`date`”

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

---

<div class="post-metadata">

**Author:** ![dsheets](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dsheets/32/5823_2.png) [@dsheets](https://forums.docker.com/u/dsheets)\
**Post date:** [May 27, 2016, 9:09am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/6 "2016-05-27T09:09:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lyonfnal](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lyonfnal](https://forums.docker.com/u/lyonfnal)\
**Post date:** [June 2, 2016, 4:06am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/7 "2016-06-02T04:06:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ruimarinho](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ruimarinho/32/8188_2.png) [@ruimarinho](https://forums.docker.com/u/ruimarinho)\
**Post date:** [June 2, 2016, 11:16pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/8 "2016-06-02T23:16:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mountainpenguin](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mountainpenguin](https://forums.docker.com/u/mountainpenguin)\
**Post date:** [June 23, 2016, 10:35am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/9 "2016-06-23T10:35:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ernestmueller](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/ernestmueller/32/11748_2.png) [@ernestmueller](https://forums.docker.com/u/ernestmueller)\
**Post date:** [June 24, 2016, 3:21pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/10 "2016-06-24T15:21:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lyonfnal](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lyonfnal](https://forums.docker.com/u/lyonfnal)\
**Post date:** [June 28, 2016, 3:21am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/11 "2016-06-28T03:21:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![reinhart](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/reinhart/32/11826_2.png) [@reinhart](https://forums.docker.com/u/reinhart)\
**Post date:** [June 29, 2016, 5:48am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/12 "2016-06-29T05:48:58Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![mountainpenguin](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mountainpenguin](https://forums.docker.com/u/mountainpenguin)\
**Post date:** [July 27, 2016, 3:18pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/13 "2016-07-27T15:18:37Z")

</div>

appears to be a windows problem too

> [@Docker for Windows should resync VM time when computer resumes from sleep](https://forums.docker.com/t/docker-for-windows-should-resync-vm-time-when-computer-resumes-from-sleep/17825):
>
> Expected behavior The clock in the Hyper-V machine is in sync with the host at all times. Actual behavior When the computer goes to sleep and is resumed, the Hyper-V virtual machine clock is delayed by the amount of time the computer was asleep. This causes all sort of subtle issues, e.g. I just spent several hours wondering why my OAuth credentials were working on my host machine, but failing with invalid\_grant when running from the container, and it turned out that the clock in the VM was ou…

---

<div class="post-metadata">

**Author:** ![warhammerkid](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/warhammerkid/32/12863_2.png) [@warhammerkid](https://forums.docker.com/u/warhammerkid)\
**Post date:** [August 4, 2016, 6:44pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/14 "2016-08-04T18:44:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![errordeveloper](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/errordeveloper/32/6294_2.png) [@errordeveloper](https://forums.docker.com/u/errordeveloper)\
**Post date:** [September 21, 2016, 9:55am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/15 "2016-09-21T09:55:26Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![drewish](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/drewish/32/10461_2.png) [@drewish](https://forums.docker.com/u/drewish)\
**Post date:** [October 25, 2016, 4:23pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/16 "2016-10-25T16:23:16Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![andrewzkeating](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@andrewzkeating](https://forums.docker.com/u/andrewzkeating)\
**Post date:** [October 29, 2016, 8:58am UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/17 "2016-10-29T08:58:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![fulcrum](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/fulcrum/32/14034_2.png) [@fulcrum](https://forums.docker.com/u/fulcrum)\
**Post date:** [October 29, 2016, 7:11pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/18 "2016-10-29T19:11:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bdentino](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/bdentino/32/13534_2.png) [@bdentino](https://forums.docker.com/u/bdentino)\
**Post date:** [November 8, 2016, 8:00pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/19 "2016-11-08T20:00:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snky1987](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@snky1987](https://forums.docker.com/u/snky1987)\
**Post date:** [November 22, 2016, 4:23pm UTC](https://forums.docker.com/t/syncing-clock-with-host/10432/20 "2016-11-22T16:23:29Z")

</div>

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

[Next page](https://forums.docker.com/t/syncing-clock-with-host/10432.md?page=2)
