Syncing clock with host

I find I have this problem too when I wake up my Mac after it was sleeping for a few minutes. This command seems to work (perhaps replace centos:6.7 with ubuntu or a base image you already have - I think any image will work so long as you enter as the root user)

docker run --rm --privileged centos:6.7 date -s “`date`”

(Note the back quotes)

Setting the date/time in any container sets it for the underlying VM, and so all containers see the new time.

Kind of a pain, but it seems to work.

1 Like