首页 > 技术文章 > GitLab——如何快速部署GitLab仓库

wangyang0210 2021-01-25 16:51 原文

前言

GitLab官方文档 : https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose
DockerComposer : https://docs.docker.com/compose/install/

步骤

搭建步骤

  1. docker和docker-compose安装
    可参考Jenkins部署中的Docker安装

  2. 创建本地挂载卷目录

mkdir -p /app/data/gitlab/{data,logs,config}
cd /app/data/
chown -R 1000:1000 gitlab/
Local location Container location Usage
$GITLAB_HOME/data /var/opt/gitlab For storing application data.
$GITLAB_HOME/logs /var/log/gitlab For storing logs.
$GITLAB_HOME/config /etc/gitlab For storing the GitLab configuration files.
  1. 创建docker-compose.yml
version: "3.6"
services:
  gitlab:
    image: gitlab/gitlab-ee:latest
    container_name: gitlab
    restart: always
    hostname: '192.168.0.89'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.0.89'
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
    ports:
      - "2222:22"
      - "80:80"
      - "443:443"
    volumes:
      - /app/data/gitlab/data:/var/opt/gitlab
      - /app/data/gitlab/logs:/var/log/gitlab
      - /app/data/gitlab/config:/etc/gitlab
  1. 运行
docker-compose up -d

使用步骤

  1. 访问且修改密码
#gitlab服务器IP
http://192.168.0.89/

  1. 登录后台
默认账户: root
密码: 上面修改的密码

默认是开放注册权限,如果不想开放可以自行设置。

推荐阅读