栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > 服务器

基于CentOS8系统使用Docker搭建Gitlab的详细教程

服务器 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力
目录
  • 一、安装Docker
  • 二、安装GitLab
  • 三、初始化GitLab

一、安装Docker
#1、卸载旧版本
yum remove docker 
    docker-client 
    docker-client-latest 
    docker-common 
    docker-latest 
    docker-latest-logrotate 
    docker-logrotate 
    docker-engine
    
#2、下载需要的安装包
sudo yum install -y yum-utils

#3、设置镜像的仓库,推荐使用阿里云的,十分的快
yum-config-manager 
    --add-repo 
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
#4、更新yum软件包的索引
yum makecache

#5安装新版的containerd.io
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
	
#6、安装docker相关的内容 docker-ce 社区版 ee企业版
sudo yum install docker-ce docker-ce-cli --allowerasing

#7、启动Docker
systemctl start docker

#8、判断是否启动成功
docker version


image-20210930141611884

二、安装GitLab

官方文档

①、新建容器数据卷文件夹

mkdir /data/gitlab/config -p
mkdir /data/gitlab/logs -p
mkdir /data/gitlab/data -p

②、运行GitLab容器

docker run --detach 
  --hostname localhost 
  --publish 4443:443 --publish 8880:80 --publish 2222:22 
  --name gitlab 
  --restart always 
  --volume /data/gitlab/config:/etc/gitlab 
  --volume /data/gitlab/logs:/var/log/gitlab 
  --volume /data/gitlab/data:/var/opt/gitlab 
  gitlab/gitlab-ee:latest


image-20210930141527798

跟踪查看日志

docker logs -f gitlab

③、优化内存占用 如果配置够高,任性的可以不用优化,跳过即可

因为我们挂载了容器数据卷,直接到主机下修改配置文件

vim /data/gitlab/gitlab.rb

Ⅰ、更改内存限制设置

取消注释


image-20210930152720351

Ⅱ、减少数据库缓存

256改为了128


image-20210930153533878

Ⅲ、减少数据库并发数

8改为了4


image-20210930153643236

④、访问测试

开启防火墙端口

firewall-cmd --zone=public --add-port=8880/tcp --permanent
firewall-cmd --zone=public --add-port=4443/tcp --permanent
firewall-cmd --zone=public --add-port=2222/tcp --permanent

查看本机ip

ip addr


image-20210930153800231

访问http://192.168.225.128:8880


image-20210930153821513

三、初始化GitLab

①、登录

使用root用户登录,查看密码:

docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password


image-20210930154505130

登录成功,进入个人主页修改密码即可


image-20210930162025461

②、创建工程

权限级别选择Internal,除了外部用户其他人都能访问


image-20210930162310547

③、安装Git

yum install git
git version 2.27.0

④、拉取项目

git clone http://localhost:8880/root/customproject.git


image-20210930162948174

⑤、测试推送更改到远程

cd customproject/touch test.txtgit add test.txt git commit -m 'test push'git push origin main


image-20210930163426788


image-20210930163443779

⑥、创建自己的账号

注册完毕后登录管理员账号,进入个人主页,点击右上角的小人,进入用户界面,然后将刚刚注册的用户审批通过


image-20210930164501637

点击刚才创建的项目,点击Members,将刚才创建的用户邀请进来即可


image-20210930164727950

到此这篇关于基于CentOS8系统使用Docker搭建Gitlab教程的文章就介绍到这了,更多相关Docker搭建Gitlab内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/698052.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号