解决方式一:追加容器启动参数-v /etc/localtime:/etc/localtime:ro或-e "TZ=Asia/Shanghai"解决方式二:调整 Dockerfile 参数ENV TZ=
解决方式一:追加容器启动参数
-v /etc/localtime:/etc/localtime:ro或-e "TZ=Asia/Shanghai"
解决方式二:调整 Dockerfile 参数
ENV TZ=America/Los_AngelesRUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
- 参照:
- https://serverfault.com/questions/683605/docker-container-time-timezone-will-not-reflect-changes
- http://stackoverflow.com/questions/22800624/will-docker-container-auto-sync-time-with-the-host-machine