• cenos 下docker安装gitlab


    1.国内拉取镜像比较慢,所以这里采用DaoCloud源。

    1
    # curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://43049fd0.m.daocloud.io

    2.拉取镜像

    另一个镜像 

    gitlab/gitlab-ce:latest
    1
    # docker pull twang2218/gitlab-ce-zh

      

    3.启动容器

    1
    2
    3
    4
    5
    6
    7
    8
    9
    docker run --detach
        --hostname git.xiaohuruwei.com
        --publish 8443:443 --publish 8080:80 --publish 2222:22
        --name gitlab
        --restart always
        --volume /srv/gitlab/config:/etc/gitlab
        --volume /srv/gitlab/gitlab/logs:/var/log/gitlab
        --volume /srv/gitlab/gitlab/data:/var/opt/gitlab
        twang2218/gitlab-ce-zh:latest

    4.命令参数解释

    1
    2
    3
    4
    5
    6
    7
    8
    --hostname
    指定容器中绑定的域名,会在创建镜像仓库的时候使用到,这里绑定git.xiaohuruwei.com
     
    --publish
    端口映射,冒号前面是宿主机端口,后面是容器expose出的端口
     
    --volume
    volume 映射,冒号前面是宿主机的一个文件路径,后面是容器中的文件路径

      

    5.本地访问地址

    1
    git.xiaohuruwei.com

    注:首次打开时,需要设置用密码。默认用户名为root。

    ssh方式访问

    因为是使用docker部署的,通过ssh方式(比如git clone git@git.xiaohuruwei.com)访问会有两层认证:

    一层是freelancer服务器的认证
    另一层是gitlab的认证。
    后者需要使用ssh-key
    前者可能需要ssh本身的反向代理(现在使用的nginx不支持除http,https以外的反向代理),

    现在发现使用端口转发的形式比较困难,但是可以改变默认的gitlab的ssh端口为非标准端口:
    直接修改gitlab配置文件中的变量:

    1
    gitlab_shell_ssh_port = 2222

    然后重新启动docker容器,就可以在web界面中看到相应的ssh地址发生了改变:
    ssh://git@git.xiaohuruwei.com:2222/root/test.git 然后就直接可以继续使用git clone来继续操作了

  • 相关阅读:
    Data Base Oracle 常用命令
    ASP.NET Core ASP.NET Core+MVC搭建及部署
    Hadoop 之 MapReduce 框架演变详解
    计算机网络: IP地址,子网掩码,默认网关,DNS服务器详解
    Linux系统基本网络配置之ifconfig命令
    Linux-eth0 eth0:1 和eth0.1关系、ifconfig以及虚拟IP实现介绍
    Linux 中将用户添加到组的指令
    几种常见的Shell
    常见的Shell
    Linux(CentOS6.5)下创建新用户和组,并制定用户和组ID
  • 原文地址:https://www.cnblogs.com/xuzishuai/p/8880566.html
Copyright © 2020-2023  润新知