Skip to content

Build Git Server Using GitLab with Podman

Goals

  • Running GitLab Server on Linux with Podman

Requirements

  • Linux Server with Podman

1. Config github.rb

Config github.rb file with following options

external_url 'http://127.0.0.1:8929'
gitlab_rails['gitlab_ssh_host'] = 'gitlab.yourdomain.com'
gitlab_rails['gitlab_shell_ssh_port'] = 22
nginx['listen_addresses'] = ['*', '[::]']
nginx['listen_port'] = 8929

2. Install GitLab with Podman

(1). Download dockerhub image

podman pull docker.io/gitlab/gitlab-ce:latest

(2). Run Container

podman run --detach --privileged \
    --name gitlab \
    --restart always \
    --hostname gitlab.yourdomain.com \
    --user $(id -u):$(id -g) \
    -p 8929:8929 \
    -p 22022:22 \
    -v ./config:/etc/gitlab:z \
    -v ./logs:/var/log/gitlab:z \
    -v ./data:/var/opt/gitlab:z \
    --shm-size 256m \
    --group-add keep-groups \
    docker.io/gitlab/gitlab-ce:latest
- 22022:22->将本机10022端口映射到docker内的22 - 8929:8929->将本机13000端口映射到docker内的3000 - /data/gogs是本机存放数据的位置

3. Update GitLab

(1). BackUp

Backup Repository with following command

gitlab-rake gitlab:backup:create

REF

[1]. https://zhuanlan.zhihu.com/p/531244799