通过Docker安装GitLab

gitLab中文镜像

Docker-compose配置文件

version: '3'
services:
    gitlab:
      image: 'twang2218/gitlab-ce-zh:11.1.4'
      restart: always
      hostname: '192.168.1.5'
      environment:
        TZ: 'Asia/Shanghai'
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://192.168.0.107'
          gitlab_rails['time_zone'] = 'Asia/Shanghai'
          # 需要配置到 gitlab.rb 中的配置可以在这里配置,每个配置一行,注意缩进。
          # 比如下面的电子邮件的配置:
          # gitlab_rails['smtp_enable'] = true
          # gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
          # gitlab_rails['smtp_port'] = 465
          # gitlab_rails['smtp_user_name'] = "xxxx@xx.com"
          # gitlab_rails['smtp_password'] = "password"
          # gitlab_rails['smtp_authentication'] = "login"
          # gitlab_rails['smtp_enable_starttls_auto'] = true
          # gitlab_rails['smtp_tls'] = true
          # gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com'
      ports:
        - '80:80'
        - '443:443'
        - '2222:22'
      volumes:
        - /Users/xiaoming/gitlab/config:/etc/gitlab
        - /Users/xiaoming/gitlab/data:/var/opt/gitlab
        - /Users/xiaoming/gitlab/logs:/var/log/gitlab
volumes:
    /Users/xiaoming/gitlab/config:
    /Users/xiaoming/gitlab/data:
    /Users/xiaoming/gitlab/logs:

之后执行docker-compose up即可。

配置ssh

使用git生成的密钥文件或者通过以下命令生成密钥文件:

ssh-keygen -t rsa -C "your_email@example.com"

之后就可以使用ssh进行远程克隆:

git clone ssh://git@192.168.0.107:2222/xm/helloGitLab.git