【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
相关推荐
Aliex_git5 天前
Dockerfile 优化实践笔记
笔记·学习·gitlab
成为你的宁宁6 天前
Jenkins 自动化部署前后端分离若依项目全攻略:涵盖环境配置、Maven/Node.js 工具安装、GitLab 项目协同,及前后端构建、服务器推送与代码更新验证全步骤
node.js·自动化·gitlab·jenkins·maven
sunshinebo6 天前
一次 GitLab 无法启动的排查:Docker 日志把 500G 磁盘打满
docker·eureka·gitlab
何以不说话6 天前
DevOps、Git 和 GitLab
git·gitlab·devops
ZAEQgyKFs9 天前
永磁同步电机模型预测电流控制+滑模控制 [1]速度环采用滑模控制 滑模控制器采用新型趋近律与扰...
gitlab
马克Markorg9 天前
使用 Docker Compose 本地部署 GitLab 教程
docker·容器·gitlab
大尚来也12 天前
CI/CD 流水线搭建实战:GitHub Actions vs GitLab CI 2026 深度对比与选型指南
ci/cd·gitlab·github
ProgramHan13 天前
github、gitlab、gitee分别都是什么,为什么不能访问?
gitee·gitlab·github
Aliex_git15 天前
Gitlab Runner 配置实践
笔记·学习·ci/cd·gitlab
阿莫西林夹馍15 天前
GitLab的IP地址发生变更导致Runner掉线
gitlab