Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复容器运行环境时区的问题 #6305

Closed
wants to merge 1 commit into from
Closed

Conversation

eryajf
Copy link
Contributor

@eryajf eryajf commented Apr 4, 2024

原来的Dockerfile没有处理时区的问题,默认运行的时区为UTC时间,导致应用打印的日志时间也与当下时区不符。

做了一些调整,以规避此问题。

before:

$ date
Thu Apr  4 09:00:32 UTC 2024

after:

$ date
Thu Apr  4 17:01:41 CST 2024

@li-peifeng
Copy link

调整到中国上海,中国的用户好了,考虑到其他国家的用户吗?

@eryajf
Copy link
Contributor Author

eryajf commented Apr 7, 2024

调整到中国上海,中国的用户好了,考虑到其他国家的用户吗?

是个好问题,所以调整一下,改成可配置化是不是更合适

@itsHenry35
Copy link
Contributor

调整到中国上海,中国的用户好了,考虑到其他国家的用户吗?

是个好问题,所以调整一下,改成可配置化是不是更合适

不,应该与宿主机同步

@li-peifeng
Copy link

调整到中国上海,中国的用户好了,考虑到其他国家的用户吗?

是个好问题,所以调整一下,改成可配置化是不是更合适

不,应该与宿主机同步

是的,应该读取宿主机的时区

@eryajf
Copy link
Contributor Author

eryajf commented Apr 7, 2024

调整到中国上海,中国的用户好了,考虑到其他国家的用户吗?

是个好问题,所以调整一下,改成可配置化是不是更合适

不,应该与宿主机同步

有道理,看了下应该不需要调整代码,调整启动命令就可以了:

$ docker run -it xhofe/alist date
Sun Apr  7 14:53:11 UTC 2024

$ docker run -it -e "TZ=Asia/Shanghai"  xhofe/alist date
Sun Apr  7 22:53:29 CST 2024

此pr可关闭了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants