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

[Bug] Docker版中时区的问题 #1224

Open
6 tasks done
lnc1995 opened this issue Apr 26, 2024 · 3 comments
Open
6 tasks done

[Bug] Docker版中时区的问题 #1224

lnc1995 opened this issue Apr 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@lnc1995
Copy link

lnc1995 commented Apr 26, 2024

Verify steps

  • 确保你使用的是本仓库最新的的 mihomo 或 mihomo Alpha 版本 Ensure you are using the latest version of Mihomo or Mihomo Alpha from this repository.
  • 如果你可以自己 debug 并解决的话,提交 PR 吧 Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • 我已经在 Issue Tracker 中找过我要提出的问题 I have searched on the issue tracker for a related issue.
  • 我已经使用 Alpha 分支版本测试过,问题依旧存在 I have tested using the dev branch, and the issue still exists.
  • 我已经仔细看过 Documentation 并无法自行解决问题 I have read the documentation and was unable to solve the issue.
  • 这是 Mihomo 核心的问题,并非我所使用的 Mihomo 衍生版本(如 OpenMihomo、KoolMihomo 等)的特定问题 This is an issue of the Mihomo core per se, not to the derivatives of Mihomo, like OpenMihomo or KoolMihomo.

Mihomo version

alpha-8ff56b5

What OS are you seeing the problem on?

Linux

Mihomo config

TZ Asia/Shanghai

Mihomo log

No response

Description

Docker版本中,Linux没有打包时区文件,对容器设置TZ参数的话,对mihomo主程序有效,但是系统时间不变,这就导致主程序和系统时间差8小时。目前就发现一个代理文件会显示成8小时前更新,倒不是什么大问题。
主要有的Docker环境,没办法挂载操作系统的localtime文件,比如ROS,只能是手动添加localtime文件。

@lnc1995 lnc1995 added the bug Something isn't working label Apr 26, 2024
@fakeboboliu
Copy link

这是一个误解,现在有 tzdata 了。

系统时间不变是因为用了 alpine 但没有用 LSIO 那种一套 init 脚本来让他的行为符合你的预期。

@lnc1995
Copy link
Author

lnc1995 commented Apr 26, 2024

这是一个误解,现在有 tzdata 了。

系统时间不变是因为用了 alpine 但没有用 LSIO 那种一套 init 脚本来让他的行为符合你的预期。

你的意思是镜像中有tzdata的文件,但是没有加载这文件还是?
所以这个问题有什么用户这边可以用的持久化的解决办法吗?
我现在是手动放一个localtime文件在etc目录。

@fakeboboliu
Copy link

这是一个误解,现在有 tzdata 了。
系统时间不变是因为用了 alpine 但没有用 LSIO 那种一套 init 脚本来让他的行为符合你的预期。

你的意思是镜像中有tzdata的文件,但是没有加载这文件还是? 所以这个问题有什么用户这边可以用的持久化的解决办法吗? 我现在是手动放一个localtime文件在etc目录。

我现在不确定他那里搞出来了问题(懒得看)

但镜像是不可变的,最快的解决方案是你用下面的文件 docker build 一个镜像:

FROM metacubex/mihomo:latest
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants