Will docker container auto sync time with the host machine?

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

    If you prefer the TZ solution then you may be surprised to see UTC time displayed despite your request for your own timezone (it's currently 11:09 CDT):

    $ docker run --rm -it -e "TZ=America/Chicago" ubuntu date
    Mon Oct 26 16:09:04 America 2020
    

    Experimentally, it seems you need the POSIX TZ format:

    $ docker run --rm -it -e "TZ=CST6CDT" ubuntu date
    Mon Oct 26 11:09:17 CDT 2020
    

提交回复
热议问题