美文网首页
docker - 运行 gitlab

docker - 运行 gitlab

作者: somefree | 来源:发表于2019-12-03 12:01 被阅读0次

    docker 安装请参考: docker - 环境搭建

    服务搭建

    # 获取镜像
    docker pull gitlab/gitlab-ce
    
    # 启动容器
    docker run -d \
      --rm \
      --restart always \
      -u root \
      --privileged \
      --hostname domain.com \
      --name gitlabCT \
      -p 80:80 \
      -v /root/gitlab/config:/etc/gitlab \
      -v /root/gitlab/logs:/var/log/gitlab \
      -v /root/gitlab/data:/var/opt/gitlab \
      gitlab/gitlab-ce
    ## 参数解释
    ## -d 后台运行, 如果容器无法正常运行, 可以去掉此项, 观察报错日志
    ## --rm 关闭容器时, 自动删除容器
    ## --restart always - 使容器跟随 docker 启动 (开机, 重启)
    ## -u root - 指定容器用户
    ## --privileged - 授予容器特权, 使用该参数, container内的root拥有真正的root权限, 否则, container内的root只是外部的一个普通用户权限。
    ## --hostname domain.com - 配置 gitlab 显示的主机名
    ## -p ${local_port}:80 - 端口映射, 左边是宿主机的监听端口, 80是 gitlab 在容器中的监听端口
    ## -v ${local_path}:${container_path} - 文件路径映射, 左边是本地路径, 右边是 gitlab 在容器中使用的路径 (不要修改)
    
    # 查看容器状态
    docker ps
    
    # 结束运行
    docker rm -f gitlabCT
    

    web管理

    初始用户 root

    以下设置均为个性化的需求, 仅供参考

    • 关闭用户注册

    Admin Area > Settings > Sign-up restrictions > Sign-up enabled

    • 关闭 CI/CD pipline

    Admin Area > Settings > CI/CD > Continuous Integration and Deployment > Default to Auto DevOps pipeline for all projects

    • 关闭 ssh 访问

    Admin Area > Settings > General > Visibility and access controls > Enabled Git access protocols

    相关文章

      网友评论

          本文标题:docker - 运行 gitlab

          本文链接:https://www.haomeiwen.com/subject/jflcgctx.html