使用docker搭建gitlab詳解
使用docker搭建gitlab
在服務器上直接安裝gitlab,會裝入Git,Redis ,postgresql,nginx等。如果主機已有redis、nginx等,配置會比較麻煩。而且以后gitlab的備份和遷移都不方便。附主機安裝教程:
https://about.gitlab.com/downloads/#centos7
如果將gitlab進行Docker化部署,所有服務如redis,postgresql等放在一個docker容器里,將配置、數(shù)據(jù)等文件掛載在宿主機上,備份和遷移時候只要復制docker鏡像和掛載的數(shù)據(jù)目錄即可。
運行gitlab容器
#查找鏡像
[root@cloud ~]# docker search gitlab
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/gitlab/gitlab-ce GitLab Community Edition docker image base... 946 [OK]
docker.io docker.io/sameersbn/gitlab Dockerized gitlab web server 803 [OK]
docker.io docker.io/gitlab/gitlab-runner 143 [OK]
docker.io docker.io/gitlab/gitlab-ee GitLab Enterprise Edition docker image bas... 47
# 拉取鏡像
docker pull docker.io/gitlab/gitlab-ce
# 啟動鏡像(使用橋接網(wǎng)絡啟動docker)
docker run --name='gitlab-ce' -d \
--net=none \
--restart always \
--volume /home/gitlab/config:/etc/gitlab \
--volume /home/gitlab/logs:/var/log/gitlab \
--volume /home/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce
# 設置網(wǎng)絡IP
pipework br0 gitlab-ce 132.97.8.10/24@132.97.8.1
配置gitlab服務器的訪問地址
修改gitlab的配置文件
vi /home/gitlab/config/gitlab.rb # 配置http協(xié)議所使用的訪問地址 external_url 'http://132.97.xxx.xxx'
修改gitlab.rb配置文件之后,重啟容器?;蛘咴谌萜骼飯?zhí)行gitlab-ctl reconfigure命令。
# 進入容器 docker exec -it gitlab-ce bash # 重啟gitlab gitlab-ctl reconfigure
瀏覽器打開http://132.97.xxx.xxx即可訪問到gitlab
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
Docker報錯denied:requested access to the r
這篇文章主要為大家介紹了Docker報錯denied:requested access to the resource is denied解決方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-06-06
docker利用WebHook實現(xiàn)持續(xù)集成
這篇文章主要介紹了docker利用WebHook實現(xiàn)持續(xù)集成的相關知識,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2018-01-01
docker容器數(shù)據(jù)卷之具名掛載和匿名掛載問題
容器數(shù)據(jù)卷就是目錄的掛載,將我們的容器的目錄掛載到宿主機上,從而實現(xiàn)打通宿主機和容器之間的文件共享功能,這篇文章主要介紹了docker容器數(shù)據(jù)卷 - 具名掛載和匿名掛載問題,需要的朋友可以參考下2021-11-11

