1. Gitea official website Docker installation instructions

Gitea official use docker installation instructions

2. Personal operation

(1) Docker-compose installs Gitea

Check if docker-compose is not available

docker-compose

docker-compose

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    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:
      - ./data:/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

Copy the code

Docker-compose UP -d docker-compose PS

(2) Log in to Gitea, open the browser and enterhttp://localhost:3000/Note that localhost is replaced with your server’S IP address

Change the value to the server IP address

Set the administrator account -> Install now

(3) Obtain the key and set it

Run ssh-keygen -t rsa [email protected]
cd ~/.ssh
cat id_rsa.pub

Set the key

3. Problems encountered

⠿ server Error                                                                                                                                                   0.0s
 ⠿ db Error                                                                                                                                                       0.0s
Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:49413->[::1]:53: read: connection refused

Copy the code

When a similar problem occurs, execute dig @114.114.114.114 Registrie-1.docker. IO on to see the IP address returned

Then go to cat /etc/hosts to modify the file and add the corresponding IP address and name. In my hosts file, the OBTAINED IP address may be different in each of the following cases

127.0.0.1 localhost localhost.localdomain localhost4 localhost4. Localdomain4 ::1 localhost localhost.localdomain Localhost6 localhost6. Localdomain6 20.205.243.166 185.199.109.154 github.com github-releases.githubusercontent.com 185.199.111.133 objects.githubusercontent.com 52.55.124.246 registry - 1. Docker. IO 34.237.244.67 auth. The docker. IO 104.18.121.25 production.cloudflare.docker.comCopy the code