Richard Bucker

boot2docker time sync

Posted at — Oct 19, 2014

I’m struggling to keep my docker container and docker host’s clock in sync with my host (laptop). The challenge is when I put my MBA to sleep the VM (VirtualBox) stops receiving clock ticks. In turn the VM believes that nothing ever happened and so the clock is late.There are a number of ways that this is supposed to be addressed. (1) the VM should have installed the VirtualBox tools. This might allow the VM to trigger on wake but who knows for sure. (2) ntpclient appears to be running as a daemon and it also seems to be running… but it’s not updating the clock. And while there is a /var/log/ntpclient.log file it’s empty.There are a few choices to make things right.(i) stop and start docker. This seems to force the ntpclient to do the right thing.boot2docker stop && boot2docker start(ii) you can just run the ntpclient command manuallyboot2docker ssh – dateboot2docker ssh – /usr/local/bin/ntpclient -c 1  -q 200  -h pool.ntp.orgI’d prefer that ntpclient was working properly.