GitLab——如何快速部署GitLab仓库

2024-08-16 14:04:41 浏览数 (1)

前言

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. 创建本地挂载卷目录
代码语言:javascript复制
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
代码语言:javascript复制
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. 运行
代码语言:javascript复制
docker-compose up -d

使用步骤

  1. 查看密码
代码语言:javascript复制
cat /app/data/gitlab/config/initial_root_password 
  1. 访问并登录

默认账户: root 密码: 上面查看的密码

代码语言:javascript复制
#gitlab服务器IP
http://192.168.0.89/

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

0 人点赞