Ubuntu+docker+gitlab安装和使用
以前自己写的代码都是在本地,因为都是自己一个人维护,现在交给团队维护了,所以想着搭建一个gitlab
1,拉镜像
安装非常简单
docker search gitlab 搜索镜像
docker pull gitlab/gitlab-ce 拉取镜像
docker images 查询镜像
2,创建本地映射文件
test-team-server:~$ mkdir gitlab
test-team-server:~$ cd gitlab/
test-team-server:~/gitlab$ mkdir config logs data
3,安装
docker run --detach -p 8843:443 -p 8090:80 -p 2222:22 --name gitlab --restart always -v /home/dapeng/gitlab/config:/etc/gitlab -v /home/dapeng/gitlab/logs:/var/log/gitlab -v /home/dapeng/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
docker ps -a | grep gitlab
docker logs -f gitlab
4,配置
访问gitlab http://192.168.1.119:8090
(1)设置密码,初始账户为root,设置密码之后就可以登录了
(2)重启、启动、停止、状态
gitlab-ctl restart // 重启
gitlab-ctl stop // 停止
gitlab-ctl start // 启动
gitlab-ctl status //状态
(3)修改hostname
gitlab项目默认是以容器id作为hostname,ssh访问的时候会提示hostname找不到,所以我们需要修改一下配置文件
/home/dapeng/gitlab/config/gitlab.rb 主要修改以下几个值
external_url 'http://192.168.1.119' #修改为http访问的外部映射的主机ip和port
gitlab_rails['gitlab_ssh_host'] = '192.168.1.119' #修改为ssh访问的外部映射的主机ip或者hostname
gitlab_rails['gitlab_shell_ssh_port'] = 2222 #ssh默认是22端口,改成映射到外部的2222端口
然后执行一下docker restart gitlab
这样在项目中显示的访问gitlab仓库的地址是
ssh://git@192.168.1.119:8090:2222/automation/apitest.git
http://192.168.1.119/automation/apitest.git
(4)下载git.exe 到本地windows
- Git-2.8.1-64-bit.exe 安装,默认选项即可
- 打开git bash, 生成密钥,有关密钥的说明可以参考 http://192.168.1.119:8090/help/ssh/README#generating-a-new-ssh-key-pair
ssh-keygen -o -t rsa -b 4096 -C "xxxxxxxxx@xxxxx.com" 然后一直回车
- 复制~/.ssh/id_rsa.pub内容,
~表示用户目录,比如windows就是C:\Users\Administrator
Administrator@ERIC MINGW64 ~/.ssh
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCrPgBRiWV7d6yRTdkLkP0ae+6P571uMDtxAL1x2fsNGWvmzFZTHUrHS49UJgPpaGu0ZtOv4X7bX4mmEHlmSXo5v6lZ5YC+oEAWXgg2c+ES9jf4llfOggCYEIrek//xF6OTOrZxpvzrTkAroiTdeRtivnFnIMgaNz3rO53ryH0M5L9vzWFKm7ufuKyqY/910X73+9pP9Rf1txWgY8cd3iVGSjooKPND0rY34sVm7JQ16llx49MjIKTX79e2V3p+wy6LOuSawwH9XtQrakj01aXmhQHKIRIqTn0M0FYtEitEQxuagBdzeyMF46rMWrk8k87FnJaPsIm/WNRMVimiL4UlSjp3iSg4p/+GebzdBr8S3oXT6lWglQBVXLEYHZgXRQXNhTCOoeOWEdW1wtKYPpGY+LtMkSEGbt0/v68Fj3oDXllVle3SjlI4i9KF86snfQPd3jDvBu7padvDmwtl3bLWKA38/DLe+cTUSHgymTTmfW6fDT5VpcAlKkyh6Dvcyb0hlUGdNVzasQ4nqtQtODpGhb5pfdtJlhZN2P0QlI7n0KAEPkuQUnpNMKf94fmUxiH6QQLOeVrWuZw4CW/B+bnYHoe85vySNhUI+H2qat5+3/p09AD+mxffKbSgmR6QWE9DXFTIGjtJ01dMFy699Qi8YOVsXwViOiu9Lab9ymxqLQ== hailiangyou@dingtalk.com
(4)网页上配置ssh-key
http://192.168.1.119:8090/profile/keys

把上面cat出来的内容复制到gitlab页面上

5,拉取项目,git常规使用
1,创建一个文件夹作为仓库repo D盘下的repo文件夹
打开git bash, cd /d/repo
2,设置用户名和邮箱
git config --global user.name "eric"
git config --global user.email "xxxx@xxx.com"
3,克隆项目,默认拉取的是master分支
git clone ssh://git@192.168.1.119:2222/automation/apitest.git
Administrator@ERIC MINGW64 /d/repo
$ git clone ssh://git@192.168.1.119:2222/automation/apitest.git
Cloning into 'apitest-framework'...
The authenticity of host '[192.168.1.119]:2222 ([192.168.1.119]:2222)' can't be established.
ECDSA key fingerprint is SHA256:IoMGBM4jlCN20ynwVKKrvwUFb8pKP5BjfZy5QG0/A2c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.1.119]:2222' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
4,git使用
在本地创建一个待push的测试文件,test.md
touch test,md
git status #可以看到红色提示该分支有需要更新的文档 test.md

git add test.md #添加文件到待上传的缓冲区里
git commit -m "test push test.md" #提交并解释

git push origin master #提交到仓库主分支

然后就可以在gitlab网页上看到刚刚提交的文件
关于更详细的git使用教程,可以查看https://www.runoob.com/git/git-tutorial.html
Ubuntu+docker+gitlab安装和使用的更多相关文章
- Ubuntu bitnami gitlab 安装
/************************************************************************************** * Ubuntu bit ...
- Centos + docker,Ubuntu + docker介绍安装及详细使用
docker笔记 常用命令 设置docker开机自启:sudo chkconfig docker on 查所有镜像: docker images 删除某个镜像:docker rmi CONTAINER ...
- ubuntu docker inflxudb(安装 使用 备份 还原 以及python编码) telegraf Grafana
inflxudb1.7.7 1.拉取最新的镜像 docker pull influxdb 2.运行实例: docker run -d --restart=always -p 8086:8086 -p ...
- ubuntu docker的安装和使用
Docker CE for Ubuntu Docker CE for Ubuntu is the best way to install the Docker platform on Ubuntu L ...
- Ubuntu Docker 简单安装 GitLab
相关博文: Ubuntu 简单安装 Docker Ubuntu 简单安装和配置 GitLab 服务器版本 Ubuntu 16.04 LTS. 1. 安装和配置 安装命令: sudo docker ru ...
- docker gitlab安装
mkdir -p /data/docker/volumes/gitlab chmod 777 /data/docker/volumes/gitlab cd /data/docker/volumes/g ...
- Ubuntu+docker+jenkins安装详细指南
最近项目上开始实行自动化测试,避免不了与jenkins等持续集成工具打交道,今天就给大家分享一下有关jenkins的简单安装和使用 1,准备环境 (1)ubuntu系统 (2)docker (3)je ...
- ubuntu docker 环境安装
转载:https://www.cnblogs.com/blog-rui/p/9946382.html 1. 在Ubuntu中安装Docker 更新ubuntu的apt源索引 sudo apt-get ...
- Ubuntu Docker 安装和配置 GitLab CI 持续集成
相关文章: Ubuntu Docker 简单安装 GitLab 劈荆斩棘:Gitlab 部署 CI 持续集成 目的:在 Ubuntu 服务器上,使用 Docker 安装和配置 GitLab Runne ...
随机推荐
- springboot + jedisCluster
如果使用的是redis2.x,在项目中使用客户端分片(Shard)机制. 如果使用的是redis3.x中的集群,在项目中使用jedisCluster. 1.项目结构 2.pom.xml 1 <? ...
- OPC协议
详解OPC协议-工业控制和自动化领域的接口标准 摘要:OPC全称是OLEforProcessControl,即用于过程控制的OLE,是针对现场控制系统的一个工业标准接口,是工业控制和生产自动化 ...
- 原型工具介绍———墨刀以及Axure RP比较
原型工具——墨刀以及Axure的比较 1759233 目录 一.了解背景... 1 二.下面分开介绍一下这两款工具... 1 2.1 Axure RP. 1 2.2墨刀... 6 三.比较... 8 ...
- Delphi - 使用Pos、Copy函数定位和截取字符串
使用Pos函数来定位子字符串第一次出现的位置 函数定义: Function Pos(Substr: String, S: String): Integer; 表示取出Substr在S中第一次出现的位置 ...
- ACdream1726-A Math game+(DFS+二分)+(DFS+前缀和)
传送门 官方题解:http://acdream.info/topic?tid=4246 参考:https://www.cnblogs.com/nowandforever/p/4492428.html ...
- CF - 1108 E 枚举上界+线段树维护
题目传送门 枚举每个点作为最大值的那个点.然后既然是作为最大值出现的话,那么这个点就是不需要被减去的,因为如果最小值也在这个区间内的话,2者都减去1,对答案没有影响,如果是最小值不出现在这个区间内的话 ...
- Codeforces Technocup 2017 - Elimination Round 2 D. Sea Battle(贪心)
题目链接 http://codeforces.com/contest/729/problem/D 题意:给你一个1*n的区域有a艘船,每艘船宽b,已经开了k枪都没打到,问你最少再开几枪至少能打到一艘船 ...
- 2017 ACM/ICPC Asia Regional Qingdao Online 1003 The Dominator of Strings hdu 6208
The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java ...
- 结合生活案例实现rabbitmq消息通信
title: 基于springboot实现rabbitmq消息通信 date: 2019-09-11 09:00:30 tags: - [rabbitmq] categories: - [spring ...
- Zabbix4.2对IIS监控摸索记录
Zabbix是很强大,但是相关的细节技术文档貌似很少,摸索之路就显得异常难. 度娘搜了下,关于Zabbix对IIS的监控资料确实有,确实也讲如何操作了,但是细细按照对方的要求操作下,总是缺数据,no ...