Docker安装gitlab

  1. 安装docker

  2. 安装firewalld

  3. firewalld开启宿主机端口

    firewall-cmd --permanent --zone=public --add-port=22/tcp
    firewall-cmd --permanent --zone=public --add-port=80/tcp
    firewall-cmd --permanent --zone=public --add-port=443/tcp
    firewall-cmd --reload
    firewall-cmd --list-ports
    
  4. 拉取gitlab镜像

    docker pull gitlab/gitlab-ce
    
  5. 创建外部挂载目录

    mkdir /data
    mkdir /data/gitlab
    mkdir /data/gitlab/cnf
    mkdir /data/gitlab/log
    mkdir /data/gitlab/opt
    
  6. 通过gitlab镜像启动一个容器

    docker run -dit \
    -p 22:22 -p 80:80 -p 443:443 \
    -v /data/gitlab/cnf:/etc/gitlab \
    -v /data/gitlab/log:/var/log/gitlab \
    -v /data/gitlab/opt:/var/opt/gitlab \
    --restart always --name gitlab \
    gitlab/gitlab-ce
    
  7. 修改配置文件

    vim /data/gitlab/cnf/gitlab.rb
    
    external_url                            'http://宿主机局域网IP:80'
    nginx['listen_port']                  = 80
    
    gitlab_rails['gitlab_ssh_host']       = '宿主机局域网IP'
    gitlab_rails['gitlab_shell_ssh_port'] = 22
    
    unicorn['worker_processes']           = 2
    unicorn['worker_memory_limit_min']    = '200 * 1 << 20'
    unicorn['worker_memory_limit_max']    = '300 * 1 << 20'
    
    sidekiq['concurrency']                = 5
    
    postgresql['shared_buffers']          = '128MB'
    
    ESC
    :wq
    
  8. 重载配置

    # 方法1
    docker restart gitlab
    # 方法2
    docker exec -it gitlab bash
    gitlab-ctl reconfigure
    
Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 12-12-31 12:00

results matching ""

    No results matching ""