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

Time zone in docker container is in UTC, even when mounting localtime and timezone files from host #32530

Open
user00265 opened this issue Nov 16, 2024 · 0 comments
Labels

Comments

@user00265
Copy link

user00265 commented Nov 16, 2024

Description

Looking at published packages in my repository, I noticed that it said "4 hours ago" when it should've been "10 hours ago" in the Gitea web interface. At this point, after looking at dates and times overall I noticed that Gitea was following UTC and not CST/CDT (visually in the interface) even though configured for America/Chicago. While investigating I issued the date command on the console of the docker container showing the time zone in UTC instead of CST as expected, while the host is showing CST as expected.

I verified that both /etc/timezone and /etc/localtime from the host are passed to the container as volumes as suggested in the documentation and their contents are available to the docker container. Both files contain valid data, and the host has the correct time zone.

Out of curiosity, I installed tzdata (apk add tzdata inside the running container) after reading #13070 even though #6421 suggests the volumes that I verified fix the time zone, and installing tzdata has corrected the discrepancies across Gitea properly visually. When Gitea triggers any scheduled workflows it is still doing so in UTC as expected.

Gitea Version

1.23.0+dev-669-ge546480d0a built with GNU Make 4.4.1, go1.23.3 : bindata, timetzdata, sqlite, sqlite_unlock_notify
Docker image hash is sha256:a7ec154a7f566ac6c897716085d930f4bd911e457f4aeb19e66bad7e167e3ffe

Can you reproduce the bug on the Gitea demo site?

Not relevant.

Log Gist

No response

Screenshots

No response

Git Version

Not relevant.

Operating System

Docker host is Alpine Linux (Edge)
Docker v27.3.1

How are you running Gitea?

Running on docker from gitea/gitea:nightly with default values for everything. Set env vars for the [mailer] section. Set the TZ variable as I set that for ALL my containers by default. Mounted /data/ on a docker local volume.

Database

PostgreSQL v16.4

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

No branches or pull requests

1 participant