【gitlab】--安装部署

文章目录

docker创建

1.yaml文件

官网参考:https://docs.gitlab.com/install/docker/installation/

中文版本:https://gitlab.cn/docs/jh/install/docker/installation/#create-a-directory-for-the-volumes

镜像选择:

yaml 复制代码
services:
  gitlab:
    image: gitlab/gitlab-ce:18.1.4-ce.0
    container_name: gitlab-ce-18.1.4
    restart: always
    hostname: '10.168.1.106'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        # Add any other gitlab.rb configuration here, each on its own line
        external_url 'http://10.168.1.106:8088'
        gitlab_rails['gitlab_shell_ssh_port'] = 222
    ports:
      - '8088:8088'
      - '44344:443'
      - '222:22'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
    shm_size: '256m'

检查:

bash 复制代码
# 检查GitLab服务是否全部正常运行
docker exec gitlab-ce-18.1.4 gitlab-ctl status

# 检查配置文件
cat /etc/gitlab/gitlab.rb | grep -E "external_url|gitlab_shell_ssh_port"

2.初始密码

初始密码位置:

gitlab/config/initial_root_password

3.设置中文


4.禁用新注册

4.修改root账户密码

进入容器
bash 复制代码
docker exec -it gitlab /bin/bash
进入控制台
bash 复制代码
gitlab-rails console
获取root用户
ruby 复制代码
user = User.where(id:1).first
修改密码
ruby 复制代码
user.password = 'YourNewPassword'
再次输入密码
ruby 复制代码
user.password_confirmation = 'YourNewPassword'
保存
ruby 复制代码
user.save!

5.gitlab.rb常用配置

ip端口配置

rb 复制代码
external_url 'http://10.168.1.106:8080'
bash 复制代码
# 修改完全后重新配置 GitLab

# 重新配置 GitLab
gitlab-ctl reconfigure

# 重启 GitLab
gitlab-ctl restart

# 清除缓存(如果需要)
gitlab-rake cache:clear
相关推荐
熙客15 小时前
GitLab:代码管理
gitlab
Lin_Aries_04212 天前
通过配置 GitLab 自动触发项目自动化构建与部署
运维·docker·容器·自动化·云计算·gitlab
peihexian2 天前
gitlab runner 里面使用harbor私仓
gitlab
angushine2 天前
gitlab定时备份
gitlab
走上未曾设想的道路2 天前
k8s集群与gitlab registry连接
容器·kubernetes·gitlab
VirusVIP2 天前
gitlab解决合并冲突本地处理的步骤
gitlab
jqh_04843 天前
docker jenkins gitlab 流水线构建
docker·gitlab·jenkins
泻水置平地4 天前
gitlab操作技巧
gitlab
骑士9991114 天前
安装gitlab并上传本地项目
gitlab
Lin_Aries_04214 天前
基于 GitLab 的自动化镜像构建
linux·运维·docker·容器·自动化·gitlab