Will docker container auto sync time with the host machine?

前端 未结 7 1988
长情又很酷
长情又很酷 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:10

    The simplest solution appears to be to run your container with the -v /etc/localtime:/etc/localtime:ro option. Thus:

    #run without tz info:
    docker run --rm -t -i ubuntu date
    Wed Apr  2 18:40:07 UTC 2014
    # run with tz info:
    docker run --rm -t -i -v /etc/localtime:/etc/localtime:ro ubuntu date
    Wed Apr  2 11:40:29 PDT 2014
    

提交回复
热议问题