Prerequis

- Firewalld activated, important otherwise the routing to the app is not working 
- Podman, jq installed

Import image

1podman pull docker.io/gitea/gitea:1-rootless
2podman save docker.io/gitea/gitea:1-rootless -o gitea-rootless.tar
3podman load < gitea-rootless.tar

Install

cat /etc/systemd/system/container-gitea-app.service

 1# container-gitea-app.service
 2[Unit]
 3Description=Podman container-gitea-app.service
 4
 5Wants=network.target
 6After=network-online.target
 7RequiresMountsFor=/var/lib/containers/storage /var/run/containers/storage
 8
 9[Service]
10Environment=PODMAN_SYSTEMD_UNIT=%n
11Restart=on-failure
12TimeoutStopSec=70
13PIDFile=%t/container-gitea-app.pid
14Type=forking
15
16ExecStartPre=/bin/rm -f %t/container-gitea-app.pid %t/container-gitea-app.ctr-id
17ExecStart=/usr/bin/podman container run \
18          --conmon-pidfile %t/container-gitea-app.pid \
19          --cidfile %t/container-gitea-app.ctr-id \
20          --cgroups=no-conmon \
21          --replace \
22          --detach \
23          --tty \
24          --env DB_TYPE=sqlite3 \
25          --env DB_HOST=gitea-db:3306 \
26          --env DB_NAME=gitea \
27          --env DB_USER=gitea \
28          --env DB_PASSWD=9Oq6P9Tsm6j8J7c18Jxc \
29          --volume gitea-data-volume:/var/lib/gitea:Z \
30          --volume gitea-config-volume:/etc/gitea:Z \
31          --network gitea-net \
32          --publish 2222:2222 \
33          --publish 3000:3000 \
34          --label "io.containers.autoupdate=registry" \
35          --name gitea-app \
36          docker.io/gitea/gitea:1-rootless
37
38ExecStop=/usr/bin/podman container stop \
39          --ignore \
40          --cidfile %t/container-gitea-app.ctr-id \
41          -t 10
42
43ExecStopPost=/usr/bin/podman container rm \
44          --ignore \
45          -f \
46          --cidfile %t/container-gitea-app.ctr-id
47
48[Install]
49WantedBy=multi-user.target default.target

Configuration inside /var/lib/containers/storage/volumes/gitea-config-volume/_data/app.ini

 1[server]
 2APP_DATA_PATH           = /var/lib/gitea
 3SSH_DOMAIN              = localhost
 4HTTP_PORT               = 3000
 5ROOT_URL                = http://gitea.example.local:3000/
 6DISABLE_SSH             = false
 7; In rootless gitea container only internal ssh server is supported
 8START_SSH_SERVER        = true
 9SSH_PORT                = 2222
10SSH_LISTEN_PORT         = 2222
11BUILTIN_SSH_SERVER_USER = git
12LFS_START_SERVER        = true
13DOMAIN                  = example.local
14LFS_JWT_SECRET          = Cn_qAC8UnzbApyzsBvAGHnecCkImxpcUeRZInT0vlxU
15OFFLINE_MODE            = false
 1# Start app
 2systemctl daemon-reload 
 3systemctl start container-gitea-app
 4
 5# Get IP 
 6sudo podman inspect --format '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' gitea-app
 7sudo podman inspect --format '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' gitea-db
 8
 9# Get inside the container
10podman exec -it gitea-app /bin/bash
11
12# inside the container
13bash-5.1$ gitea admin user list
14bash-5.1$ gitea admin user create --username local_admin --email admins@email.earth --admin --random-password
15generated random password is 'qwertyuiop'
16New user 'local_admin' has been successfully created!

Sources:

https://www.digitalocean.com/community/tutorials/how-to-install-gitea-on-ubuntu-using-docker

https://blog.while-true-do.io/podman-setup-gitea/