• Docker部署Gitlab


    GitLab 分为 社区版(Community Edition,缩写为 CE)和 企业版(Enterprise Edition,缩写为 EE)。

    下载镜像

    docker pull gitlab/gitlab-ce
    

    创建目录

    通常会将 GitLab 的配置 (etc) 、 日志 (logs) 、数据 (data) 放到容器之外, 便于日后升级, 因此请先准备这三个目录

    mkdir -p  /srv/gitlab/{config,logs,data}
    

    启动

    docker run --detach 
      --hostname gitlab.example.com 
      --publish 8443:443 --publish 8880:80 --publish 8222: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 
      --privileged=true 
      gitlab/gitlab-ce:latest
    
    • --hostname gitlab.example.com: 设置主机名或域名
    • --publish 8443:443:将http:443映射到外部端口8443
    • --publish 8880:80:将web:80映射到外部端口8880
    • --publish 8222:22:将ssh:22映射到外部端口8222
    • --name gitlab: 运行容器名
    • --restart always: 自动重启
    • --volume /srv/gitlab/config:/etc/gitlab: 挂载目录
    • --volume /srv/gitlab/logs:/var/log/gitlab: 挂载目录
    • --volume /srv/gitlab/data:/var/opt/gitlab: 挂载目录
    • --privileged=true 使得容器内的root拥有真正的root权限。否则,container内的root只是外部的一个普通用户权限

    浏览器访问:

    IP+8880

    首次访问需要为root用户设置密码,设置完成后需要登录,

    默认用户名为:root, 密码为刚刚设置的密码。

    使用

    Git global setup

    git config --global user.name "Administrator"
    git config --global user.email "admin@example.com"
    

    Create a new repository

    git clone http://gitlab.example.com/root/test.git
    cd test
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master
    

    Push an existing folder

    cd existing_folder
    git init
    git remote add origin http://gitlab.example.com/root/test.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    
  • 相关阅读:
    easyui_1
    JSONOBJECT
    基础回顾—list遍历4种
    <input type=file>上传唯一控件
    window.open
    poi--导入
    java字符串的替换
    一、IIS搭建前端静态模板_资源加载问题
    一、ASP.NET Iframework_SignalR集线器类(v2)
    一、ASP.NET Iframework_SignalR永久连接类(v2)
  • 原文地址:https://www.cnblogs.com/syavingcs/p/14282468.html
Copyright © 2020-2023  润新知