Will docker container auto sync time with the host machine?

前端 未结 7 1973
长情又很酷
长情又很酷 2020-11-28 18:43

Giving I already changed the timezone of docker container correctly. Do I need to install a NTP server inside the docker container to periodically sync the time or the conta

相关标签:
7条回答
  • 2020-11-28 19:29

    On Docker for Mac OS X Beta, I experienced significant drift on the VM, which is based on Alpine Linux. From Alpine Linux FAQ you can synchronize the VM's clock with the following command.

    ntpd -d -q -n -p pool.ntp.org
    

    However, getting access to a terminal on the VM is another question, which can be done if you use the screen command.

    screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
    

    That path is a symlink, which on my system points at /dev/ttys003.

    Once you get in, note that the moby login is simply root with no password. After you have finished, CTRL-A, D will disconnect from the screen session.

    NOTE: This used to be documented on Docker for Mac Trouble Shooting but that seems to have been taken down. I was lucky enough to be shown it while at Dockercon 2016. It seems Docker is trying to abstract the VM completely out of the experience, which explains why it's no longer documented.

    0 讨论(0)
提交回复
热议问题