1. 創(chuàng)建docker-compose.yml
[h@archlinux gitea]$ cat docker-compose.yml
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:nightly
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- 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
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
db:
image: postgres:14
restart: always
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=gitea
- POSTGRES_DB=gitea
networks:
- gitea
volumes:
- ./postgres:/var/lib/postgresql/data
[h@archlinux gitea]$
2.容器編排
docker-compose up -d
3.登錄設(shè)置
ip:3000
基本不改設(shè)置
關(guān)閉注冊(cè)功能
為gitea倉(cāng)庫(kù)添加一個(gè)管理,不設(shè)置的話則默認(rèn)第一個(gè)注冊(cè)的賬號(hào)為管理員賬號(hào)梢杭。
自己注冊(cè)個(gè)賬號(hào)
4.修改 ssh 轉(zhuǎn)發(fā)才能正常使用 git ssh
[h@archlinux gitea]$ cat ~/.ssh/config
# Gitea
Host 192.168.21.56
HostName 192.168.21.56
Port 222
User git
IdentityFile ~/.ssh/id_rsa
[h@archlinux gitea]$