Prevent time drift in Docker with docker-time-sync-agent

Today, at work, a colleague of mine ran into some time issues with his Docker containers: the time was clearly off. Turns out it’s a common problem:

Docker’s daemon fails to update the VM’s time after computer wakes up from sleep. The result is that VM’s clock will be set to a past time. This inturn will make Docker containers use that time.

Enter docker-time-sync-agent:

docker-time-sync-agent is a tool to prevent time drift in Docker for Mac’s HyperKit VM. It listens to system wakeup event and runs a shell script (update-docker-time) that updates the VM’s time. Time sync can be triggered manually anytime by running update-docker-time.

Install it using this oneliner (if you dare copy-pasting it, that is):

$ curl | bash

docker-time-sync-agent – prevent time drift in Docker for Mac’s HyperKit VM →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.