blank
blank
发布于 2019-10-18 / 1040 阅读 / 0 评论 / 0 点赞

docker-compose 运行 gogs (git 服务)

创建 gogs 数据目录

mkdir -p /docker/gogs/data
mkdir -p /docker/gogs/log

创建 docker-compose.yml

cat > /docker/gogs/docker-compose.yml << EOF
version: '3.7'

services:

  gogs:
    image: gogs/gogs
    container_name: gogs
    restart: always
    #privileged: true
    environment:
      TZ: "Asia/Shanghai"
    volumes:
      - "./data:/data"
      - "./log:/var/log/gogs"
    ports:
      - 3000:3000
EOF

运行

cd /docker/gogs && docker-compose up -d && docker-compose logs -f

Creating network "gogs_default" with the default driver
Pulling gogs (gogs/gogs:)...
latest: Pulling from gogs/gogs
9d48c3bd43c5: Already exists
1013a6a6073e: Pull complete
f074cb3ecafc: Pull complete
33433d770f0d: Pull complete
b464f169dfd9: Pull complete
77e3c5692f7d: Pull complete
e6d8ab097b45: Pull complete
13266a8e4353: Pull complete
2ac951b0051b: Pull complete
266414b76811: Pull complete
Digest: sha256:48cd3d14f6d5c9f73cd462b42e67f7a021b299da8fdaa2003cc164fe6ed08a38
Status: Downloaded newer image for gogs/gogs:latest
Creating gogs ... done
Attaching to gogs
gogs    | usermod: no changes
gogs    | Oct 18 11:30:36 syslogd started: BusyBox v1.30.1
gogs    | Oct 18 03:30:36 sshd[34]: Server listening on :: port 22.
gogs    | Oct 18 03:30:36 sshd[34]: Server listening on 0.0.0.0 port 22.
gogs    | 2019/10/18 11:30:36 [ WARN] Custom config '/data/gogs/conf/app.ini' not found, ignore this if you're running first time
gogs    | 2019/10/18 11:30:36 [TRACE] Custom path: /data/gogs
gogs    | 2019/10/18 11:30:36 [TRACE] Log path: /app/gogs/log
gogs    | 2019/10/18 11:30:36 [TRACE] Build Time: 2019-10-04 03:52:46 UTC
gogs    | 2019/10/18 11:30:36 [TRACE] Build Git Hash: 1c82c42cb357b4d1c190a30346f52e11427e8470
gogs    | 2019/10/18 11:30:36 [TRACE] Log Mode: Console (Trace)
gogs    | 2019/10/18 11:30:36 [ INFO] Gogs 0.11.94.1003
gogs    | 2019/10/18 11:30:36 [ INFO] Cache Service Enabled
gogs    | 2019/10/18 11:30:36 [ INFO] Session Service Enabled
gogs    | 2019/10/18 11:30:36 [ INFO] SQLite3 Supported
gogs    | 2019/10/18 11:30:36 [ INFO] Run Mode: Development
gogs    | 2019/10/18 11:30:37 [ INFO] Listen: http://0.0.0.0:3000

访问 docker 的 host ip/域名 初始化 gogs

gogs-init

测试 git

echo 'test' > README.md
git init
git add .
git config user.name "blank"
git config user.email "[email protected]"
git commit -m "first commit"
git remote add origin http://192.168.10.51:3000/blank/test.git
git push -u origin master
Username for 'http://192.168.10.51:3000': blank
Password for 'http://[email protected]:3000': 
枚举对象: 3, 完成.
对象计数中: 100% (3/3), 完成.
写入对象中: 100% (3/3), 212 bytes | 212.00 KiB/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
To http://192.168.10.51:3000/blank/test.git
 * [new branch]      master -> master
分支 'master' 设置为跟踪来自 'origin' 的远程分支 'master'。

可以看到远程仓库已经推送成功

gogs-repositories-create-push

DONE


评论