【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
相关推荐
有理想的打工人3 天前
gitlab的参数设置与团队管理
gitlab
有理想的打工人3 天前
gitlab群组管理与ssh链接
ssh·gitlab
M-Ellen3 天前
从零搭建 Windows + WSL2 + Docker + GitLab CI/CD 完整手册
ci/cd·docker·gitlab
大脸胖柴3 天前
webStorm+gitLab操作学习
学习·gitlab·webstorm
jekc8685 天前
Ubuntu-GitLab
服务器·ubuntu·gitlab
在路上走着走着6 天前
openclaw v2026.4.5 版本 提示 pairing required 解决方案
gitlab
Gazer_S10 天前
【GitLab npm Registry 非标准端口安装问题解决方案】
前端·npm·gitlab
-KamMinG10 天前
Gitlab版本升级方案-13.x到17.x
gitlab
菜鸡000112 天前
把一个项目传到 GitLab 的某个群组
大数据·elasticsearch·gitlab
AlbertS13 天前
记一次推送lfs失败不能迁移git仓库到新的gitlab的问题
git·ai·gitlab·lfs·rejected