How to make sure docker's time syncs with that of the host?

前端 未结 17 1544
北恋
北恋 2020-12-02 07:10

I have dockers running on Linode servers. At times, I see that the time is not right on the dockers. Currently I have changed the run script in every docker to include the f

17条回答
  •  执念已碎
    2020-12-02 07:21

    If you're using docker-machine, the virtual machines can drift. To update the clock on the virtual machine without restarting run:

    docker-machine ssh 
    sudo ntpclient -s -h pool.ntp.org
    

    This will update the clock on the virtual machine using NTP and then all the containers launched will have the correct date.

提交回复
热议问题