Tag Archives: services.server Additional property db is not allowed

[Solved] rocky-linux8.5 Install gitea Error: services.server Additional property db is not allowed

problem

Today we use rocky – Linux 8 5 installed docker composer and then gitea. An error was encountered during installation services server Additional property db is not allowed

Solution:

First of all, other errors were reported for the yml format problem. After the problem was resolved, the above error was reported. Some people on the Internet said that it is related to the version of docker-compose, but it is not. The docker version I use is 20.10.12, and the version of docker-compose is v2.2.2 (offline installation), finally check the yml format, where the mirror image gitea and mysql are not at the same level, mysql is used as a sub-layer of gitea, and gitea is depend-on mysql. You can adjust it to the same level later.

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.15.7
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=mysql
      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
       - "3000:3000"
       - "222:22"
    depends_on:
       - db
 
  db:
    image: mysql:8
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    networks:
      - gitea
    volumes:
         - ./mysql:/var/lib/mysql

The reason for the error is that depends_on is db, and db and server are not at the same level. You can find the reason by comparing with online yml or a text editor.