Skip to content

fix: docker timezone #161

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

Merged
merged 1 commit into from
Mar 3, 2023
Merged

fix: docker timezone #161

merged 1 commit into from
Mar 3, 2023

Conversation

jakezhu9
Copy link
Member

fix #101

add tzdata in Dockerfile and set Asia/Shanghai as the default timezone

we can also change timezone by specifying the environment variables -e TZ=Asia/Shanghai

@1379
Copy link
Contributor

1379 commented Feb 18, 2023

Thansk! And sorry to see it so late.
There are several problems:

  1. The installation of tzdata should be in the builder stage
  2. If other time zones are specified through environment variables, can they take effect
  3. The default time zone should be more international

@jakezhu9
Copy link
Member Author

Thanks for review

  1. To support changing timezone by env, we should install tzdata in prod. This will provide us with all the necessary timezone data. They can take effect
  2. As many of users are Chinese and i18n still in the todo list, I think it't better to set the default timezone to Asia/Shanghai

@1379
Copy link
Contributor

1379 commented Feb 20, 2023

But you only copied the Asia/Shanghai time zone file to/etc/localtime. If specified other time zones through the environment variable, wouldn't the file be missing in/etc/localtime?

@jakezhu9
Copy link
Member Author

Both /etc/localtime and /etc/timezone are used to configure the current time zone of the system. Other files are stored in /usr/share/zoneinfo and will be read when specified.

I have tested it (here i use podman, the same to docker)
image

@jakezhu9
Copy link
Member Author

jakezhu9 commented Mar 3, 2023

@1379 any updates on this? let me know if you have any questions

@1379
Copy link
Contributor

1379 commented Mar 3, 2023

Sorry,I am too busy😭

@1379 1379 merged commit 777ae13 into go-sonic:master Mar 3, 2023
@1379
Copy link
Contributor

1379 commented Mar 3, 2023

Thanks

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

Successfully merging this pull request may close these issues.

日志的显示时区问题
2 participants