在安装完 Docker 后,可以在终端中运行以下命令来下载 Gogs Docker 镜像:
docker pull gogs/gogs
docker run --name=gogs -p 10022:22 -p 10880:3000 -v /var/gogs:/data gogs/gogs
解释:
docker run # 通过 Docker 运行
--name=gogs # 取个名字叫 gogs
-p 10022:22 # 把 Docker 中的 22 端口映射到宿主机的 10022 端口。
-p 3000:3000 # 把 Docker 中的 3000 端口映射到宿主机的 3000 端口。
-v /var/gogs:/data # 把 Docker 中的 /data 目录映射到 /var/gogs 目录。
gogs/gogs # 用 gogs/gogs 这个镜像创建。
安装完成后你需要来到 /var/gogs/gogs/conf 目录下修改 app.ini 文件;将22端口改为你需要用的端口配置参考:
BRAND_NAME = Gogs
RUN_USER = git
RUN_MODE = prod
[database]
TYPE = postgres
HOST = ip:5432
NAME = postgres
SCHEMA = gogs
USER = username
PASSWORD = password
SSL_MODE = disable
PATH = /app/gogs/data/gogs.db
[repository]
ROOT = /data/git/gogs-repositories
DEFAULT_BRANCH = master
[server]
DOMAIN = ip
HTTP_PORT = 3000
EXTERNAL_URL = http://localhost:3000/
DISABLE_SSH = false
SSH_PORT = 1111
START_SSH_SERVER = true
OFFLINE_MODE = false
[email]
ENABLED = false
[auth]
REQUIRE_EMAIL_CONFIRMATION = false
DISABLE_REGISTRATION = false
ENABLE_REGISTRATION_CAPTCHA = true
REQUIRE_SIGNIN_VIEW = false
[user]
ENABLE_EMAIL_NOTIFICATION = false
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = false
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = Info
ROOT_PATH = /app/gogs/log
[security]
INSTALL_LOCK = true
SECRET_KEY = puyxwoijfowg
如上我把原22 端口改为了 我需要用的1111端口 SSH_PORT = 1111
标签:git,false,22,gogs,3000,docker,data,Docker,搭建 From: https://www.cnblogs.com/jingwei129/p/18181538