Restarting Docker Container Leads to SQL Loop

#1

Hi there

When I start up the gitea docker container for the first time, it works perfectly well and guides me through the installation page. I enter all the values, click “Install”, and everything works like a charm.

But when I try to remove/stop the gitea container and then start it again, gitea refuses to answer.
When looking into the logs, I see that gitea is doing the same query multiple times per second, thus preventing gitea from starting up.

Is this problem known and if yes, what can I do against it?

Deleting the data volume and rerunning the installation solves the problem. But this can’t be the solution, I don’t want to rerun the installation everytime I restart the container.

I am using MySQL and my docker-compose.yml looks like this:
If you need more information, please tell me what you are looking for and I will provide!

version: "2"

services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    restart: always
    environment:
      - USER_UID=1000
      - USER_GID=100
      - DB_TYPE=mysql
      - DB_HOST=IP:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=pw
    networks:
      - central-db
    volumes:
      - ./data:/data
    ports:
      - "2224:22"

networks:
  central-db:
    external: true
#2

This should be already fixed.

#3

Well, it seems that this is not the case. Any information I can provide you with?

#4

Could you paste your logs?

#5

Certainly :slight_smile: Thank you for helping me!

Which exact logs are you looking for? docker-compose logs results in the following. Gitea seems to loop somehow. I have also tried to start the container using a MySQL database, but the same loop happened. I also just tried to move to Gitea 1.8.1, but the issue persists.

root@server:/home/gitea# docker-compose logs
Attaching to gitea, gitea-db
gitea    | May 20 05:41:08 syslogd started: BusyBox v1.29.3
gitea    | May 20 05:41:08 sshd[19]: Server listening on :: port 22.
gitea    | May 20 05:41:08 sshd[19]: Server listening on 0.0.0.0 port 22.
gitea    | 2019/05/20 05:41:08 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:08 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:08 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:08 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:10 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:10 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:10 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:10 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:12 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:12 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:12 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:12 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:14 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:14 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:14 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:14 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:14 [I] Gitea v1.8.1 built with go1.12.5 : bindata, sqlite, sqlite_unlock_notify
gitea    | 2019/05/20 05:41:17 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:17 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:17 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:17 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:19 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:19 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:19 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:19 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:21 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:21 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:21 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:21 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:21 [I] Gitea v1.8.1 built with go1.12.5 : bindata, sqlite, sqlite_unlock_notify
gitea    | 2019/05/20 05:41:23 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:23 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:23 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:23 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:25 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:25 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:25 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:25 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:27 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:27 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:27 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:27 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:29 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:29 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:29 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:29 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:31 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:31 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:31 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:31 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:33 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:33 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:33 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:33 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:36 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:36 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:36 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:36 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:38 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:38 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:38 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:38 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:40 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:40 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:40 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:40 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:42 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:42 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:42 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:42 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:44 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:44 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:44 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:44 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:46 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:46 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:46 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:46 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:48 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:48 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:48 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:48 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:50 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:50 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:50 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:50 [T] Log path: /data/gitea/log
gitea    | 2019/05/20 05:41:52 [T] AppPath: /app/gitea/gitea
gitea    | 2019/05/20 05:41:52 [T] AppWorkPath: /app/gitea
gitea    | 2019/05/20 05:41:52 [T] Custom path: /data/gitea
gitea    | 2019/05/20 05:41:52 [T] Log path: /data/gitea/log
gitea-db | 2019-05-20 05:41:07.698 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
gitea-db | 2019-05-20 05:41:07.698 UTC [1] LOG:  listening on IPv6 address "::", port 5432
gitea-db | 2019-05-20 05:41:07.700 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
gitea-db | 2019-05-20 05:41:07.718 UTC [19] LOG:  database system was shut down at 2019-05-20 05:41:05 UTC
gitea-db | 2019-05-20 05:41:07.724 UTC [1] LOG:  database system is ready to accept connections