Documentation add timezone and localtime volumes to Docker Guide #4280

Closed
opened 2025-11-02 05:44:42 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @h00000000 on GitHub (Nov 10, 2019).

  • Gitea version (or commit ref): 1.9.5
  • Git version: 2.17.1
  • Operating system: Ubuntu Server 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

When setting up gitea on a Ubuntu Server 18.04, using the Installation with Docker guide and the Fail2ban setup guide, fail2ban will not ban offenders in some timezone configurations.

After installing gitea by following the guides, i experienced the following behaviour:
Testing with fail2ban-regex will report a valid regex filter.
sudo fail2ban-regex ./gitea/log/gitea.log /etc/fail2ban/filter.d/gitea.conf

But on failed authentication attempt, fail2ban will not report the failed attempt, neither will it increment the failure detection count or proceed to ban the offender after n tries.

I found the cause of fail2ban rules not being applied being a missmatch in container and host time.

I could fix this problem by adding the following volumes to the gitea container:

- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro

I made a pull request, which adds timezone and localtime volumes to the Installation with Docker Guides docker-compose.yml examples.
Passing these volumes to the container enables gitea to use hosts localtime and timezone.

This issue was reported in the past (6421), it seems the issue was forgotten but the described problems still apply today.

Originally created by @h00000000 on GitHub (Nov 10, 2019). - Gitea version (or commit ref): 1.9.5 - Git version: 2.17.1 - Operating system: Ubuntu Server 18.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant When setting up gitea on a Ubuntu Server 18.04, using the [Installation with Docker](https://docs.gitea.io/en-us/install-with-docker/) guide and the [Fail2ban setup guide](https://docs.gitea.io/en-us/fail2ban-setup/), fail2ban will not ban offenders in some timezone configurations. After installing gitea by following the guides, i experienced the following behaviour: Testing with fail2ban-regex will report a valid regex filter. `sudo fail2ban-regex ./gitea/log/gitea.log /etc/fail2ban/filter.d/gitea.conf` But on failed authentication attempt, fail2ban will not report the failed attempt, neither will it increment the failure detection count or proceed to ban the offender after n tries. I found the cause of fail2ban rules not being applied being a missmatch in container and host time. I could fix this problem by adding the following volumes to the gitea container: ``` - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ``` I made a [pull request](https://github.com/go-gitea/gitea/pull/8911/commits/01e24cd17014a2ebeba5b011ddacbaeb366c2cc2), which adds timezone and localtime volumes to the [Installation with Docker](https://docs.gitea.io/en-us/install-with-docker/) Guides `docker-compose.yml` examples. Passing these volumes to the container enables gitea to use hosts localtime and timezone. This issue was reported in the past ([6421](https://github.com/go-gitea/gitea/issues/6421)), it seems the issue was forgotten but the described problems still apply today.
Author
Owner

@gary-kim commented on GitHub (Nov 13, 2019):

@lunny #8911 addressed this so this issue can be closed.

@gary-kim commented on GitHub (Nov 13, 2019): @lunny #8911 addressed this so this issue can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4280