custom app.ini with Docker, weird behaviour #4586

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

Originally created by @bienchen on GitHub (Jan 1, 2020).

  • Gitea version (or commit ref): 1.10.1
  • Git version: 2.22.2
  • Operating system: alpine (Docker)
  • 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

When using Docker/ Compose. Placing an app.ini in /data/gitea/ or /data/gitea/conf/ does not work. It seems like the custom config gets ignored/ deleted. It only works when I bend GITEA_CUSTOM to a different directory, /custom in my case. It seems like inside the /data/gitea/ the app.ini file gets overwritten/ deleted on startup of gitea.

Screenshots

Originally created by @bienchen on GitHub (Jan 1, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.10.1 - Git version: 2.22.2 - Operating system: alpine (Docker) - 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 - Log gist: ## Description When using Docker/ Compose. Placing an app.ini in /data/gitea/ or /data/gitea/conf/ does not work. It seems like the custom config gets ignored/ deleted. It only works when I bend GITEA_CUSTOM to a different directory, /custom in my case. It seems like inside the /data/gitea/ the app.ini file gets overwritten/ deleted on startup of gitea. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/question label 2025-11-02 05:55:25 -06:00
Author
Owner

@bienchen commented on GitHub (Jan 1, 2020):

OK, when bending the /custom directory to a volume on my disk, via Docker Compose, using a custom app.ini stops working. When I go back to use the file system inside the container it works again.

@bienchen commented on GitHub (Jan 1, 2020): OK, when bending the /custom directory to a volume on my disk, via Docker Compose, using a custom app.ini stops working. When I go back to use the file system inside the container it works again.
Author
Owner

@sapk commented on GitHub (Jan 2, 2020):

@bienchen Hi, can you provide your docker-compose file (censor any data sensible) ? or from what documentation you based it ?
It will help use understand how you are setup and diagnose what is wrong.
You can also have a look on our discord where there is a chan dedicated for docker with maintainer and users which could help you.

@sapk commented on GitHub (Jan 2, 2020): @bienchen Hi, can you provide your docker-compose file (censor any data sensible) ? or from what documentation you based it ? It will help use understand how you are setup and diagnose what is wrong. You can also have a look on our [discord](https://discord.gg/NsatcWJ) where there is a chan dedicated for docker with maintainer and users which could help you.
Author
Owner

@bienchen commented on GitHub (Jan 2, 2020):

Documentation: https://docs.gitea.io/en-us/install-with-docker/
Dockerfile is attached, docker-compose.yml attached. I think the mounting of volumes may be an issue. I copy the custom app.ini into GITEA_CUSTOM during docker build, when mounting a volume to that path the app.ini gets shadowed and gitea creates a new one on startup.

docker-compose.yml.txt

Dockerfile.txt

@bienchen commented on GitHub (Jan 2, 2020): Documentation: https://docs.gitea.io/en-us/install-with-docker/ Dockerfile is attached, docker-compose.yml attached. I think the mounting of volumes may be an issue. I copy the custom app.ini into GITEA_CUSTOM during `docker build`, when mounting a volume to that path the app.ini gets shadowed and gitea creates a new one on startup. [docker-compose.yml.txt](https://github.com/go-gitea/gitea/files/4015227/docker-compose.yml.txt) [Dockerfile.txt](https://github.com/go-gitea/gitea/files/4015225/Dockerfile.txt)
Author
Owner

@sapk commented on GitHub (Jan 2, 2020):

I just re-check the setup script and the config should not be re-written if existing. https://github.com/go-gitea/gitea/blob/master/docker/root/etc/s6/gitea/setup#L17
I will have to re-check but docker doesn't copy the original content (from container) when using bind mount.
I would suggest you to store your custom file somewhere else and copy (or link) it in the setup script to your bind path.

@sapk commented on GitHub (Jan 2, 2020): I just re-check the setup script and the config should not be re-written if existing. https://github.com/go-gitea/gitea/blob/master/docker/root/etc/s6/gitea/setup#L17 I will have to re-check but docker doesn't copy the original content (from container) when using bind mount. I would suggest you to store your custom file somewhere else and copy (or link) it in the setup script to your bind path.
Author
Owner

@bienchen commented on GitHub (Jan 2, 2020):

Yeah, if I leave the app.ini in the container file system it works. Then its present on gitea startup.

@bienchen commented on GitHub (Jan 2, 2020): Yeah, if I leave the app.ini in the container file system it works. Then its present on gitea startup.
Author
Owner

@sapk commented on GitHub (Jan 2, 2020):

I have check and bind mount are not copied.
You can override the part in the setup script that generate the configuration by copying your config set at build time just after the check that the folder doesn't exist yet https://github.com/go-gitea/gitea/blob/master/docker/root/etc/s6/gitea/setup#L17.

@sapk commented on GitHub (Jan 2, 2020): I have check and bind mount are not copied. You can override the part in the setup script that generate the configuration by copying your config set at build time just after the check that the folder doesn't exist yet https://github.com/go-gitea/gitea/blob/master/docker/root/etc/s6/gitea/setup#L17.
Author
Owner

@bienchen commented on GitHub (Jan 2, 2020):

Thanks for checking. This setup script is not called during docker build but when starting the container at entrypoint. What I'm gonna do is copy the config set into the image's file system during build and point GITEA_CUSTOM to it. That way the config file exists when the setup script checks for it.

@bienchen commented on GitHub (Jan 2, 2020): Thanks for checking. This setup script is not called during `docker build` but when starting the container at entrypoint. What I'm gonna do is copy the config set into the image's file system during build and point GITEA_CUSTOM to it. That way the config file exists when the setup script checks for it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4586