1. 创建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.登录设置
ip:3000
基本不改设置
关闭注册功能
为gitea仓库添加一个管理,不设置的话则默认第一个注册的账号为管理员账号。
自己注册个账号
4.修改 ssh 转发才能正常使用 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]$
网友评论