【私有git】使用docker搭建gitlab-ce中文社区版服务器

环境

sudo usermod -aG docker 你的用户名
newgrp - docker

1.linux 

目标

1.搭建gitlab-ce

2.如果有公网ip实现外网访问

3.使用vs code克隆仓库

步骤

首先我们先安装dokcer服务

sudo apt update   #更新apt源
sudo apt install docker.io   #安装docker

安装好后我们配置docker用户组,以便你的用户拥有docker的权限。

然后我们开始拉取容器镜像

docker search gitlab-ce

NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
gitlab/gitlab-ce                         GitLab Community Edition docker image based …   3697                 [OK]
twang2218/gitlab-ce-zh                   汉化的 GitLab 社区版 Docker Image                     258                  [OK]
beginor/gitlab-ce                        GitLab Community Edition with zh-cn             72                   [OK]
yrzr/gitlab-ce-arm64v8                   GitLab Community Edition docker image for ar…   43                   
drud/gitlab-ce                                                                           13                   
gitlab/gitlab-ce-qa                      GitLab QA has a test suite that allows end-t…   8                    
polinux/gitlab-ce                        GitLab-CE on Steroids (Extra features - see …   3                    [OK]
marq/gitlab-ce-subgit                    A GitLab container with SubGit included.        3                    [OK]
slpcat/gitlab-ce                         gitlab-ce最新社区版10.1.0,omnibus二进制包                3                    
lizhenliang/gitlab-ce-zh                                                                 2                    
computersciencehouse/gitlab-ce-oidc      GitLab CE Docker image with OpenID Connect s…   1                    [OK]
projectatomic/gitlab-centos7-atomicapp   Gitlab Atomic App                               1                    [OK]
idoall/gitlab-ce                         gitlab-ce                                       1                    [OK]
lezapedrola/gitlab-ce                                                                    0                    
toshi0123/gitlab-ce                      gitlab-ce based on alpine linux                 0                    [OK]
sstruss/gitlab-ce-armhf                  gitlab-ce armhf image for armv7/armhf platfo…   0                    
visitsb/gitlab-ce                        Fixes official https://hub.docker.com/r/gitl…   0                    
oidatiftla/gitlab-ce                     Mirror of gitlab/gitlab-ce with more tags (m…   0                    
jbuncle/gitlab-ce                                                                        0                    
visualon/gitlab-ce                       customized gitlab-ce docker image               0                    
chefplatform/gitlab-ce-kitchen           Docker image based on gitlab/gitlab-ce provi…   0                    
imachineml/gitlab-ce                                                                     0                    
ragboy/gitlab-ce                         gitlab-ce 8.4.2                                 0                    
mjvdende/gitlab-ce                       gitlab-ce pimped with latest postgresql-clie…   0                    [OK]
feeditout/gitlab-ce                                                                      0                    

我们拉取下载量最多的中文社区版gitlab-ce

docker pull twang2218/gitlab-ce-zh 

然后我们运行容器

docker run -p 8888:80 -i --name gitlab twang2218/gitlab-ce-zh  

假如你想将容器的80映射到80端口,就 -p 80:80 

然后等待服务运行完成,大概要1分钟

> worker=6
I, [2022-09-11T15:51:30.358128 #653]  INFO -- : reaped #<Process::Status: pid 837 exit 0> worker=7
I, [2022-09-11T15:51:30.358191 #653]  INFO -- : reaped #<Process::Status: pid 2413 exit 0> worker=8
I, [2022-09-11T15:51:30.358285 #653]  INFO -- : reaped #<Process::Status: pid 3170 exit 0> worker=2
I, [2022-09-11T15:51:30.358381 #653]  INFO -- : master complete

==> /var/log/gitlab/unicorn/current <==
2022-09-11_15:51:31.26116 forwarding CONT to unicorn master 653
2022-09-11_15:51:31.26126 /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper: line 132: kill: (653) - No such process
2022-09-11_15:51:31.26129 wrapper for unicorn master 653 exiting
ok: down: unicorn: 0s, normally up
Thank you for using GitLab Docker Image!
Current version: gitlab-ce=11.1.4-ce.0

Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
And restart this container to reload settings.
To do it use docker exec:

  docker exec -it gitlab vim /etc/gitlab/gitlab.rb
  docker restart gitlab

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

If this container fails to start due to permission problems try to fix it by executing:

  docker exec -it gitlab update-permissions
  docker restart gitlab

Preparing services...
Starting services...
Configuring GitLab package...
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
gitlab preinstall: 
gitlab preinstall: This node does not appear to be running a database
gitlab preinstall: Skipping version check, if you think this is an error exit now
gitlab preinstall: 
Configuring GitLab...

然后我们打开此网页

 遇到这个界面说明还没加载完,再等一下。

 好了以后会让你填写root密码

然后即可登陆

接下来如果你有公网ip又想要外网访问

我们打开路由器(默认你设置了桥街并且拨号上网)

 并添加端口映射

将虚拟机映射到物理机的端口映射到外部。

比如一开始的是8888:80 ,我就将8888端口映射出去即可。

然后使用ip:端口来进行访问。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值