使用docker搭建gitlab
在服務器上直接安裝gitlab,會裝入Git,Redis ,postgresql,nginx等。如果主機已有redis、nginx等,配置會比較麻煩。而且以后gitlab的備份和遷移都不方便。附主機安裝教程:
https://about.gitlab.com/downloads/#centos7
如果將gitlab進行Docker化部署,所有服務如redis,postgresql等放在一個docker容器里,將配置、數據等文件掛載在宿主機上,備份和遷移時候只要復制docker鏡像和掛載的數據目錄即可。
運行gitlab容器
#查找鏡像[root@cloud ~]# docker search gitlabINDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATEDdocker.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# 啟動鏡像(使用橋接網絡啟動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# 設置網絡IPpipework br0 gitlab-ce 132.97.8.10/24@132.97.8.1
配置gitlab服務器的訪問地址
修改gitlab的配置文件
vi /home/gitlab/config/gitlab.rb# 配置http協議所使用的訪問地址external_url 'http://132.97.xxx.xxx'
修改gitlab.rb配置文件之后,重啟容器?;蛘咴谌萜骼飯绦術itlab-ctl reconfigure命令。
# 進入容器docker exec -it gitlab-ce bash# 重啟gitlabgitlab-ctl reconfigure
瀏覽器打開http://132.97.xxx.xxx即可訪問到gitlab
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。
新聞熱點
疑難解答
圖片精選