docker-compose一键搭建gitlab

  1. 第一步搭建好docker与docker-compose环境
  2. 编写docker-compose.yml文件
version: "3"
services:
  gitlab:
    image: gitlab/gitlab-ce
    container_name: gitlab
    restart: always
    hostname: '192.168.31.230'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url "http://192.168.31.230:9090"
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
        gitlab_rails['gitlab_email_enabled'] = true
        gitlab_rails['gitlab_email_from'] = '[email protected]'
        gitlab_rails['gitlab_email_display_name'] = 'xxx'
        gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = "smtp.mxhichina.com"
        gitlab_rails['smtp_port'] = 465
        gitlab_rails['smtp_user_name'] = "[email protected]"
        gitlab_rails['smtp_password'] = "xxxxx"
        gitlab_rails['smtp_domain'] = "smtp.mxhichina.com"
        gitlab_rails['smtp_authentication'] = "login"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
        gitlab_rails['smtp_tls'] = true
    ports:
      - '9090:9090'
      - '2222:22'
    volumes:
      - '/srv/gitlab/config:/etc/gitlab'
      - '/srv/gitlab/logs:/var/log/gitlab'
      - '/srv/gitlab/data:/var/opt/gitlab'
    logging:
      driver: "json-file"
      options:
        max-size: "20m"
        max-file: "10"

github项目地址:https://github.com/xvjialing/gitlab_docker-compose

测试

  1. 将项目代码克隆下来
  2. 将项目中的xxx和一些配置改成自己的设置
  3. 在项目根目录下运行docker-compose up -d即可启动gitlab,其中9090为web管理界面访问端口,2222为ssh访问端口。

更新gitlab版本

运行命令docker-compose pull && docker-compose up -d

个人博客:https://blog.xvjialing.xyz
github主页:https://github.com/xvjialing

微信公众号

docker-compose一键搭建gitlab_第1张图片
微信公众号

你可能感兴趣的:(docker-compose一键搭建gitlab)