基于CentOS8系統(tǒng)使用Docker搭建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相關的內(nèi)容 docker-ce 社區(qū)版 ee企業(yè)版
sudo yum install docker-ce docker-ce-cli --allowerasing
#7、啟動Docker
systemctl start docker
#8、判斷是否啟動成功
docker version

二、安裝GitLab
官方文檔
①、新建容器數(shù)據(jù)卷文件夾
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

跟蹤查看日志
docker logs -f gitlab
③、優(yōu)化內(nèi)存占用 如果配置夠高,任性的可以不用優(yōu)化,跳過即可
因為我們掛載了容器數(shù)據(jù)卷,直接到主機下修改配置文件
vim /data/gitlab/gitlab.rb
Ⅰ、更改內(nèi)存限制設置
取消注釋

Ⅱ、減少數(shù)據(jù)庫緩存
256改為了128

Ⅲ、減少數(shù)據(jù)庫并發(fā)數(shù)
8改為了4

④、訪問測試
開啟防火墻端口
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

訪問
http://192.168.225.128:8880

三、初始化GitLab
①、登錄
使用
root用戶登錄,查看密碼:
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password

登錄成功,進入個人主頁修改密碼即可

②、創(chuàng)建工程
權限級別選擇
Internal,除了外部用戶其他人都能訪問

③、安裝Git
yum install git git version 2.27.0
④、拉取項目
git clone http://localhost:8880/root/customproject.git

⑤、測試推送更改到遠程
cd customproject/touch test.txtgit add test.txt git commit -m 'test push'git push origin main


⑥、創(chuàng)建自己的賬號
注冊完畢后登錄管理員賬號,進入個人主頁,點擊右上角的小人,進入用戶界面,然后將剛剛注冊的用戶審批通過

點擊剛才創(chuàng)建的項目,點擊
Members,將剛才創(chuàng)建的用戶邀請進來即可

到此這篇關于基于CentOS8系統(tǒng)使用Docker搭建Gitlab教程的文章就介紹到這了,更多相關Docker搭建Gitlab內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持本站!
版權聲明:本站文章來源標注為YINGSOO的內(nèi)容版權均為本站所有,歡迎引用、轉載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權,請聯(lián)系alex-e#qq.com處理。
關注官方微信