Docker: Timezone #3426

Closed
opened 2025-11-02 05:12:36 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @noboevbo on GitHub (Jun 4, 2019).

  • Gitea version (or commit ref): 1.8.2
  • Git version: 2.20.1
  • Operating system: Docker (Official Image)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

There seems to be a problem with the time zone for OpenSSH. In principle I pass the time zone as environment variable via Docker-Compose (- TZ=Europe/Berlin). The gitea logs have the correct timestamp. The SSH logs have a different timestamp, which causes problems when using fail2ban.

Example output:

`

docker logs gitea
Jun 4 11:19:06 syslogd started: BusyBox v1.29.3
Jun 4 09:19:06 sshd[19]: Server listening on :: port 22.
Jun 4 09:19:06 sshd[19]: Server listening on 0.0.0.0 port 22.
2019/06/04 11:19:06 [T] AppPath: /app/gitea/gitea
`

I already tried to set the timezone manually on top of the entrypoint script like this:
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && /usr/bin/entrypoint
The date is set correctly (e.h. when executing date), but the sshd log is still showing the wrong time. Does anyone have any idea what else could be wrong with that? Is the timezone possibly not taken over correctly by s6?

Originally created by @noboevbo on GitHub (Jun 4, 2019). - Gitea version (or commit ref): 1.8.2 - Git version: 2.20.1 - Operating system: Docker (Official Image) - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description There seems to be a problem with the time zone for OpenSSH. In principle I pass the time zone as environment variable via Docker-Compose (- TZ=Europe/Berlin). The gitea logs have the correct timestamp. The SSH logs have a different timestamp, which causes problems when using fail2ban. Example output: ` > docker logs gitea Jun 4 11:19:06 syslogd started: BusyBox v1.29.3 Jun 4 09:19:06 sshd[19]: Server listening on :: port 22. Jun 4 09:19:06 sshd[19]: Server listening on 0.0.0.0 port 22. 2019/06/04 11:19:06 [T] AppPath: /app/gitea/gitea ` I already tried to set the timezone manually on top of the entrypoint script like this: ` ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && /usr/bin/entrypoint ` The date is set correctly (e.h. when executing date), but the sshd log is still showing the wrong time. Does anyone have any idea what else could be wrong with that? Is the timezone possibly not taken over correctly by s6?
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 05:12:36 -06:00
Author
Owner

@stale[bot] commented on GitHub (Aug 3, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Aug 3, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Aug 15, 2019):

I think #7792 will fix this that you can set your Location on app.ini

@lunny commented on GitHub (Aug 15, 2019): I think #7792 will fix this that you can set your Location on app.ini
Author
Owner

@sapk commented on GitHub (Aug 15, 2019):

@lunny I think this is openssh logging so it is not related to gitea.
@noboevbo I haven't tested how openssh get his information on timezone but you may need to forward or set file
volumes:
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"

@sapk commented on GitHub (Aug 15, 2019): @lunny I think this is openssh logging so it is not related to gitea. @noboevbo I haven't tested how openssh get his information on timezone but you may need to forward or set file volumes: - "/etc/timezone:/etc/timezone:ro" - "/etc/localtime:/etc/localtime:ro"
Author
Owner

@lunny commented on GitHub (Aug 15, 2019):

@sapk you are right. This is unrelated with #7792

@lunny commented on GitHub (Aug 15, 2019): @sapk you are right. This is unrelated with #7792
Author
Owner

@sapk commented on GitHub (Aug 23, 2019):

@noboevbo does my comment resolve your issue ? Can we close it ?

@sapk commented on GitHub (Aug 23, 2019): @noboevbo does my comment resolve your issue ? Can we close it ?
Author
Owner

@noboevbo commented on GitHub (Aug 24, 2019):

@sapk sorry for the delay. I just tested it and the timezone issue is fixed! I had to forward the timezone set files like you've suggested. Thanks!

@noboevbo commented on GitHub (Aug 24, 2019): @sapk sorry for the delay. I just tested it and the timezone issue is fixed! I had to forward the timezone set files like you've suggested. Thanks!
Author
Owner

@sapk commented on GitHub (Aug 24, 2019):

Perfect. Enjoy using gitea.

@sapk commented on GitHub (Aug 24, 2019): Perfect. Enjoy using gitea.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3426