Cannot deploy with Docker and Postgres

I’ve been having trouble with deploying Gitea. I am using Docker Compose:

version: "3"

networks:
  gitea:
    external: false

volumes:
  gitea:
    driver: local

services:
  server:
    container_name: gitea
    image: gitea/gitea:latest
    environment:
      - USER=git
      - USER_UID=701
      - USER_GID=701
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - gitea:/data
      - /home/git/.ssh:/data/git
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "2222:22"
    depends_on:
      - db

  db:
    container_name: gitea_postgres
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./postgres:/var/lib/postgresql/data

After composing, the installation webpage shows up successfully, filling in the correct fields (such as ip and port).

But when I click on install button, the gitea docker container crashes (ends up in an endless restart loop).

I tried multiple times, tried changing port or installing without the first admin user account, I didn’t notice any difference.
Also I couldn’t find any error log (the log folder was empty).

I noticed that when I don’t erase gitea volume and try to compose again, the installation webpage doesn’t show up and gitea container keeps restarting (as if I clicked on the installation button).