Time in container is out of sync

Expected behavior

Correct time inside container; ideally matches the host machine

Actual behavior

Time inside is roughly 1 day behind


  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX

Docker for Mac: version: mac-v1.12.0-beta16.2
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160624-131908.tar.gz
failure: No error was detected
[OK] docker-cli
[OK] app
[OK] menubar
[OK] virtualization
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )

OSX 10.11.5

Steps to reproduce the behavior

I’m not entirely sure how to reproduce the behavior; it may have something to do with putting the computer to sleep for some time and waking it up later.

  1. Inside an Alpine Linux container (FROM ruby:2.3-alpine in my case), look at the time
  2. Put laptop to sleep for 12+ hours?
  3. Wake up laptop and look at the time

In my case, it showed the time as 2016-06-23 22:15:52 -0400, and it should have been 2016-06-24 13:15:53 -0400.

NOTE: I was able to solve this by restarting the Docker beta.


I have been seeing this a ton with containers accessing S3. Once the drift starts occurring, amazon kicks requests with the 405.

Manually restarting Docker Beta fixes the issue.

1 Like

same deal when accessing s3 and other aws services after a period of time on containers. might have been after laptop went to sleep, not sure.

Yes, the delay seems to coincide with time asleep, which makes me think the bhyve host clock stops when asleep. It should be easy to fix by putting ntpd on the xhyve host, and synchronizing with an ntpd instance on the Mac (or just tweaking the xhyve clock to use the Mac’s clock). In any case, it’s very annoying and needs to be fixed.

1 Like

that is a REAL pain in the ass…

Time is not only out of sync inside containers.
When I build an image with docker having been started yesterday (and my laptop being suspended over night) the output of docker images tells me the image has been created 16 hours ago, even though I created it just a minute ago.

When I try to push such an image to AWS elastic container registry, there is extremely slow transmission speed.

As others already mentioned restarting docker through the tray icon resolves these issues.

Right now I need to restart docker every morning.

1 Like

This is the same issue as:


docker run -it --rm --privileged --pid=host debian nsenter -t 1 -m -u -n -i date -u $(date -u +%m%d%H%M%Y)

Make it as alias command and run it when time drift.


To solve this issue I have created a project that will update the time whenever Mac wakes up from sleep.
It basically listens to the wake up event and execute a shell script whenever a wake up happens.

It is available on GitHub docker-time-sync-agent


very simple way to fix the clock-drift bug:

brew install sleepwatcher
brew services start sleepwatcher
echo /usr/local/bin/docker run --rm --privileged *OS-NAME* hwclock -s > ~/.wakeup
chmod +x ~/.wakeup

credits: immae

agree, really pain in the ass…