No access when running Gitea with Docker Compose

Hi,

I want to start Gitea using a docker-compose.yml file. I used the script from Docker Hub:

version: '2'
services:
  web:
    image: gitea/gitea:1.8.3
    volumes:
      - ./data:/data
    ports:
      - "3000:3000"
      - "22:22"
    depends_on:
      - db
    restart: always
  db:
    image: mariadb:10
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=changeme
      - MYSQL_DATABASE=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=changeme
    volumes:
      - ./db/:/var/lib/mysql

I changed the volumes to my filesystem and the username/pw. When I start this with docker compose up -d everything seems fine, but when I try to open Gitea in my brower (localhost:3000) it’s empty, as if I never startet anything. However, the service and ports are listed when I check docker ps.

I also tried starting the container through docker run. In that case everything is fine and I can open Gitea in my browser.

I’m new to both Gitea and Docker, so I hope to find some help here as I didn’t find something usefull on google.

A couple things: 1. you may want to switch to use version 1.10, as1.8 is out of date. 2. what do docker logs say? 3. are you able to post a sanitized version of your app.ini?

Thanks for your reply. In my actual Dockerfile I used the latest image.

The issue was somehow solved when I changed the volumes from bind mounts to Docker managed named volumes. I don’t know why, maybe a matter of access rights.

So now I can open Gitea. But for some reason I can’t use mysql/mariadb as database. It returns something like “The database settings are invalid. dial tcp 127.0.0.1:3306: connect: connection refused” during setup.

If you are using mysql & docker, then 127.0.0.1 would likely be an incorrect IP as 127.0.0.1 means something different to each container. If you have both DB and Gitea on the same docker network then you can use the DNS alias for the DB container.

Thanks for your reply.

I found something similar, saying I have to use host.docker.internal instead of localhost because localhost in the gitea container would not point to the mysql container. Replacing it lead to a new error message:

MySQL Connection Error: (1045) Access denied for user 'root'@'172.17.0.3' (using password: YES)

I after a restart it showed a different error (don’t remember which one) although I didn’t change anything.

I looked up DNS aliases as you suggested and added an alias. It changed the error back to “dial tcp…”, but with a different ip.

Annoyed, I said f*** it and left the running container alone for about half an hour. I came back and the error message changed again, without any interaction by me, to something about duplicate uid. I refreshed the browser page and suddenly the setup was done and I could register my admin account. I tried restarting the container to check persistence. Account was still there.

Everything seems to work now, no idea why. Except for cloning the llvm repo, that somehow keeps failing. I will probably raise an issue on Github about this, at least the docs seem to need an update

Thanks for the help.

edit: Cloning LLVM worked after increasing the Git timeouts.