teldrive icon indicating copy to clipboard operation
teldrive copied to clipboard

[Bug]: Incorrect timezone in Docker container (UTC instead of local time)

Open juanfranciscolopez28 opened this issue 8 months ago • 8 comments

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

juanfranciscolopez28 avatar Apr 21 '25 12:04 juanfranciscolopez28

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

ben-ba avatar Apr 30 '25 00:04 ben-ba

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

xd003 avatar Apr 30 '25 01:04 xd003

@ben-ba use like this

volumes:
      - /usr/share/zoneinfo:/usr/share/zoneinfo
environment:
      - TZ=Europe/Madrid

divyam234 avatar Apr 30 '25 10:04 divyam234

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

xd003 avatar Apr 30 '25 11:04 xd003

With the mapping the container uses the settings from the file on the host

ben-ba avatar Apr 30 '25 14:04 ben-ba

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.

iwconfig avatar May 01 '25 19:05 iwconfig

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.

That makes perfect sense, thanks for the explanation. i was confused as that directory is typically present in standard linux distros

xd003 avatar May 02 '25 03:05 xd003

可以通过自建镜像使用有基础linux的版本(如Debian)再安装teldrive

WUHINS avatar Sep 23 '25 20:09 WUHINS