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 runningupdate-docker-time
.
Install it using this oneliner (if you dare copy-pasting it, that is):
$ curl https://raw.githubusercontent.com/arunvelsriram/docker-time-sync-agent/master/install.sh | bash
docker-time-sync-agent
– prevent time drift in Docker for Mac’s HyperKit VM →