[Bug]: Incorrect timezone in Docker container (UTC instead of local time)
Describe the bug
Hi! I can't log in to my Telegram account, at step 2fa it seems endless loading
I'm running Teldrive using Docker and noticed that all timestamps in the logs and API responses are in UTC, even though I'm setting the TZ environment variable (e.g., Europe/Madrid).
I tried to add volume timezone and localtime too
volumes:
- ./teldrive/config.toml:/config.toml
- ./teldrive/storage.db:/storage.db
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
21/04/2025 12:11 PM INFO {"status": 204, "method": "GET", "path": "/api/auth/session", "query": "", "ip": "192.168.18.25:63908", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0", "latency": 0.000103616, "time": "2025-04-21T12:11:13Z"}
21/04/2025 12:11 PM ERROR error sending code
But my system timezone is: 2025-04-21T14:11:13
Thanks in advance!
Repoduction
Use default docker compose file in a different timezone and try to login, try to add env or volume with other timezone
Expected behavior
I want to add a custom timezone in docker file or configuration file
Version
1.6.14
Which Platform are you using?
Linux
Additional context
No response
it doesn't matter, because the system knows the difference between utc and utc+2
did you set your user in the config as allowed-user? reference: https://teldrive-docs.pages.dev/docs/getting-started/usage
I haven't checked this in teldrive but pretty sure this very same issue also exists in https://codeberg.org/teldrive/rclone-backup No matter what we set TZ environment variable, it always uses UTC
@ben-ba use like this
volumes:
- /usr/share/zoneinfo:/usr/share/zoneinfo
environment:
- TZ=Europe/Madrid
volumes: - /usr/share/zoneinfo:/usr/share/zoneinfo
Just to clarify, why are we mapping this folder from the host ? isn't this directory already present inside the docker container
With the mapping the container uses the settings from the file on the host
volumes:
- /usr/share/zoneinfo:/usr/share/zoneinfo
Just to clarify, why are we mapping this folder from the host ? isn't this directory already present inside the docker container
The teldrive docker image, like many others, does not contain any libraries, utilities, or files that are typically found in a standard Linux distribution. This is because it is built based on the scratch image, which means it usually does not include /usr/share/zoneinfo unless it is explicitly added during the build process.
The teldrive docker image, like many others, does not contain any libraries, utilities, or files that are typically found in a standard Linux distribution. This is because it is built based on the scratch image, which means it usually does not include
/usr/share/zoneinfounless it is explicitly added during the build process.
That makes perfect sense, thanks for the explanation. i was confused as that directory is typically present in standard linux distros
可以通过自建镜像使用有基础linux的版本(如Debian)再安装teldrive