OSX Docker Tip: set datetime

OSX doesn’t directly support the awesomeness that is Docker containers. It uses an intermediate Linux virtual machine, and that runs containers for you, on your behalf.

I started getting weird Amazon S3 errors. My project would work locally (in OSX), and would work inside a container (Linux), but the S3 filesystem would throw errors.
It turns out Amazon doesn’t like it if you request an asset two months in the past… The Mac system had its clock set correctly, but the VirtualBox Linux VM had drifted.

The following hops into the VM, then sets the clock based on a global Network Time Protocol server. You should only have do this a couple times a year.

boot2docker sudo ntpclient -sh pool.ntp.org