Gitlab----使用Docker方式安装部署Gitlab

网友投稿 290 2022-10-20

Gitlab----使用Docker方式安装部署Gitlab

(1)查询可用docker镜像

docker

如下:

[root@iZbp1flzt6x7pxmxfhmxeeZ ~]# docker search gitlabNAME DESCRIPTION STARS OFFICIAL AUTOMATEDgitlab/gitlab-ce GitLab Community Edition docker image based … 3439 [OK]sameersbn/gitlab Dockerfile to build a GitLab image for the D… 1178 [OK]gitlab/gitlab-runner GitLab CI Multi Runner used to fetch and run… 741 [OK]gitlab/gitlab-ee GitLab Enterprise Edition docker image based… 283twang2218/gitlab-ce-zh 汉化的 GitLab 社区版 Docker Image 249 [OK]jangrewe/gitlab-ci-android GitLab CI image for building Android apps 59 [OK]edbizarro/gitlab-ci-pipeline-php Docker images for build and test PHP applica… 38ulm0/gitlab GitLab Docker image for ARM 36gitlab/gitlab-runner-helper 34klud/gitlab-runner GitLab Runner for ARM devices 27centurylink/gitlab This image uses the image from sameersbn / g… 26 [OK]ciricihq/gitlab-sonar-scanner Gitlab Docker container to run sonar-scanner… 16 [OK]gitlab/gitlab-ce-qa GitLab QA has a test suite that allows end-t… 6timoschwarzer/gitlab-monitor A browser-based monitor dashboard for GitLab… 4 [OK]sgillespie/gitlab-runner A Dockerized GitLab Runner that automaticall… 3 [OK]samcontesse/gitlab-merge-request-resource A concourse resource to check for new merge … 3 [OK]mastertinner/gitlab-merge-request-resource A concourse resource to check for new merge … 2 [OK]boldcommerce/gitlab-merge-request-resource Reverted build of Swisscom's resource until … 1 [OK]stanfordlegion/gitlab-ci An image for Gitlab CI. 1 [OK]lorands/gitlab-merge-request-resource This is a fork of swisscom/gitlab-merge-requ… 1 [OK]edtan1/gitlab-merge-request-resource GitLab Merge Request resource for ConcourseCI 0 [OK]adamkl/gitlab-merge-request-resource Customized with support for gitlab ssh on di… 0 [OK]gitlab/gitlab-ee-qa GitLab QA has a test suite that allows end-t… 0mvisonneau/gitlab-ci-pipelines-exporter Prometheus / OpenMetrics exporter for GitLab… 0 [OK]onaci/gitlab-runner auto-registering gitlab runner 0[root@iZbp1flzt6x7pxmxfhmxeeZ ~]#

(2)下载镜像

docker

如下:

[root@iZbp1flzt6x7pxmxfhmxeeZ ~]# docker pull gitlab/gitlab-ceUsing default tag: latestlatest: Pulling from gitlab/gitlab-ce7b1a6ab2e44d: Pull complete923d8a5a90cb: Pull completec9c193ad3afb: Pull completeca54c9617521: Pull complete5c6b771a3e5e: Pull completeb4823ec4057e: Pull complete35db6611258b: Pull completecd101cdba14c: Pull completeDigest: sha256:a67074548979a08eba93445c37a5dab09e2a8e4f29b301ec5fc7a05607293121Status: Downloaded newer image for gitlab/gitlab-ce:latestdocker.io/gitlab/gitlab-ce:latest[root@iZbp1flzt6x7pxmxfhmxeeZ ~]#

(3)启动服务

docker run -d -p 10008:80 -p 10009:443 -p 10010:22 --restart always --name gitlab -v /docker/gitlab/etc/gitlab:/etc/gitlab -v /docker/gitlab/var/log/gitlab:/var/log/gitlab -v /docker/gitlab/var/opt/gitlab:/var/opt/gitlab --privileged=true gitlab/gitlab-ce

(4)修改gitlab.rb文件

vi

修改如下位置:

# 如果使用公有云且配置了域名了,可以直接设置为域名,如下external_url '如果没有域名,则直接使用宿主机的ip,如下external_url '同样如果有域名,这里也可以直接使用域名gitlab_rails['gitlab_ssh_host'] = 'gitlab.redrosee2100.com'# 同样如果没有域名,则直接使用宿主机的ip地址gitlab_rails['gitlab_ssh_host'] = '172.22.27.162'

# 端口为启动docker时映射的ssh端口gitlab_rails['gitlab_shell_ssh_port'] =10010

# 设置时区为东八区,即北京时间gitlab_rails['time_zone'] = 'Asia/Shanghai'

(5)关于邮箱发邮件的配置如下

gitlab_rails['smtp_enable'] = truegitlab_rails['smtp_address'] = "smtp.163.com" # 邮箱服务器gitlab_rails['smtp_port'] = 465 # 邮箱服务对应的端口号gitlab_rails['smtp_user_name'] = "hitredrose@163.com" # 发件箱的邮箱地址gitlab_rails['smtp_password'] = "xxxxxxxxxxx" # 发件箱对应的授权码,注意不是登录密码,是授权码gitlab_rails['smtp_domain'] = "163.com"gitlab_rails['smtp_authentication'] = "login"gitlab_rails['smtp_enable_starttls_auto'] = truegitlab_rails['smtp_tls'] = truegitlab_rails['gitlab_email_enabled'] = truegitlab_rails['gitlab_email_from'] = 'hitredrose@163.com' # 发件箱地址gitlab_rails['gitlab_email_display_name'] = 'gitlab.redrose2100.com' # 显示名称gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com' # 提示不要回复

(6) 重启docker

docker

(7)进入docker容器里

docker exec -it gitlab bash

(8)修改端口号

vi

如下,将端口修改为映射后的端口

(9)重启gitlab

直接在docker中执行

gitlab-ctl reconfiguregitlab-ctl restart

如:

root@cd6a79be7773:/etc/gitlab# gitlab-ctl restartok: run: alertmanager: (pid 4567) 1sok: run: gitaly: (pid 4582) 1sok: run: gitlab-exporter: (pid 4598) 1sok: run: gitlab-workhorse: (pid 4603) 1sok: run: grafana: (pid 4610) 1sok: run: logrotate: (pid 4619) 1sok: run: nginx: (pid 4631) 1sok: run: postgres-exporter: (pid 4636) 1sok: run: postgresql: (pid 4645) 1sok: run: prometheus: (pid 4653) 0sok: run: puma: (pid 4670) 1sok: run: redis: (pid 4679) 0sok: run: redis-exporter: (pid 4689) 1sok: run: sidekiq: (pid 4697) 1sok: run: sshd: (pid 4703)

(10)在浏览器打开 ip:端口号即可访问

这里需要注意,如果使用的是阿里云,需要配置安全组放开端口,如果使用二级域名,同样需要配置Nginx代理进行解析,

(11)查看root默认密码

cat

如:

(12)使用root用户名以及上述查询到的密码登录

(14)至此,gitlab已经安装完成,并已修改密码

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:RestTemplate如何通过HTTP Basic Auth认证示例说明
下一篇:精彩分享 | 欢乐游戏 Istio 云原生服务网格三年实践思考
相关文章

 发表评论

暂时没有评论,来抢沙发吧~