【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
相关推荐
温宇飞19 小时前
GitLab CI/CD
gitlab
你的人类朋友1 天前
hotfix分支的使用
git·gitlab·github
颇有几分姿色1 天前
Git将本地项目推送到GitLab
git·gitlab
DevOps探索之旅2 天前
国产开源代码管理工具 GitPuk 安装+入门全流程解析
gitlab·tiklab·gitpuk·国产开源代码管理工具·安装与入门教程
半梦半醒*2 天前
gitlab部署
linux·运维·centos·ssh·gitlab·jenkins
dalianwawatou2 天前
GitLab 代码基础操作清单
大数据·elasticsearch·gitlab
爱宇阳5 天前
从零开始部署 GitLab CE 18.4.2:Docker Compose 新手教程
docker·容器·gitlab
Narutolxy6 天前
从混合部署到高可用:在内网环境下搭建 GitLab-Jenkins-OpenResty的完整实战复盘20251014
gitlab·jenkins·openresty
字节逆旅6 天前
Git提交后追加修改操作指南
gitlab
爱宇阳6 天前
GitLab Docker Compose 迁移教程
docker·容器·gitlab