二十一、docker gitlab

官网教程
https://docs.gitlab.com/omnibus/docker/README.html

sudo docker run --detach \
    --hostname gitlab.example.com \
    --publish 443:443 --publish 80:80 --publish 22:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

自己准备
先创建挂载的目录

sudo docker run -d \
    -p 443:443 -p 80:80 -p 22:22 \
    --name xht-gitlab \
    --restart always \
    -v /home/joychen/docker/gitlab/etc:/etc/gitlab \
    -v /home/joychen/docker/gitlab/log:/var/log/gitlab \
    -v /home/joychen/docker/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:rc

注意错误: 下载时失败。所以换一个版本

sudo docker run -d \
    -p 443:443 -p 80:80 -p 22:22 \
    --name xht-gitlab \
    --restart always \
    -v /home/joychen/docker/gitlab/etc:/etc/gitlab \
    -v /home/joychen/docker/gitlab/log:/var/log/gitlab \
    -v /home/joychen/docker/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:nightly

注意错误: 端品22被占用 22端口一般ssh占用。 可以把这个去了,或者换一个映射端口

Error response from daemon: driver failed programming external connectivity on endpoint xht-gitlab (4f05d542b9b87275570523ff63e897fc145cbc61549eaca37bb65713f84e7844): Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use.

sudo docker run -d \
    -p 443:443 -p 80:80 -p 23:22 \
    --name xht-gitlab \
    --restart always \
    -v /home/joychen/docker/gitlab/etc:/etc/gitlab \
    -v /home/joychen/docker/gitlab/log:/var/log/gitlab \
    -v /home/joychen/docker/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:nightly

修改:
/root/docker/gitlab/data/gitlab-rails/etc/gitlab.rb

external_url "http://10.103.240.36:8080"

/root/docker/gitlab/data/gitlab-rails/etc/gitlab.yml

二十一、docker gitlab_第1张图片
image.png

最后参考博客:
https://www.cnblogs.com/int32bit/p/5310382.html
主要是要修改那个url,其它可以不用设置,然后重启

CentOS上老有一个问题

/opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
Starting Chef Client, version 13.6.4

网上的解决办法没有用可以尝试一下:解决链接如下:
https://blog.csdn.net/ma524654165/article/details/77372829

自己想的办法是把
文件 挂载出来:
在主机上给个权限看一下,方便看执行脚本,也方便授权。

/opt/gitlab/embedded/bin/runsvdir-start

先把原来的文件都删除,重新来过一次

sudo docker run -d \
 -p 443:443 -p 80:80 -p 23:22 \
 --name xht-gitlab \
 --restart always \
 -v /home/joychen/docker/gitlab/etc:/etc/gitlab \
-v /home/joychen/docker/gitlab/bin:/opt/gitlab/embedded/bin \
 -v /home/joychen/docker/gitlab/log:/var/log/gitlab \
 -v /home/joychen/docker/gitlab/data:/var/opt/gitlab \
 gitlab/gitlab-ce:nightly

这个版本比较稳定

sudo docker run -d \
    -p 443:443 -p 80:80 -p 23:22 \
    --name joy-gitlab \
    --restart always \
    -v /home/joychen/gitlab/etc:/etc/gitlab \
    -v /home/joychen/gitlab/log:/var/log/gitlab \
    -v /home/joychen/gitlab/data:/var/opt/gitlab \
    beginor/gitlab-ce:11.0.1-ce.0

发现这样runsvdir-start不会导过来。要先准备好。这种 方式无效

你可能感兴趣的:(二十一、docker gitlab)