docker镜像拉取代码,docker pull gitlab/gitlab-ce:latest.

创建/srv/gitlab目录sudo mkdir /srv/gitlab

启动GitLab CE容器,并发布访问SSH,HTTP,HTTPS的端口.
所有GitLab数据将存储在/srv/gitlab目录.
如果只在本机测试,把hostname改为本机IP地址,(如果是在虚拟机中启动,主机测试,把IP地址设置为虚拟机ip地址).如果让外部系统访问则改为外网IP.
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

如果开启了selinux,运行下面的代码:
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:Z --volume /srv/gitlab/logs:/var/log/gitlab:Z --volume /srv/gitlab/data:/var/opt/gitlab:Z gitlab/gitlab-ce:latest

--restart always: 系统重启后,容器启动

确保docker有足够的权限在挂在的卷中创建文件.

边间GitLab配置文件,可以打开一个shellsudo docker exec -it gitlab /bin/bash,或者直接编辑文件sudo docker exec -it gitlab vi /etc/gitlab/gitlab.rb

在浏览器中输入gitlab所在服务器的IP地址,初次使用需要修改密码.

生成keyssh-keygen -t rsa -C "email",将key添加到gitlab上。

配置.ssh目录和文件的权限
chmod 755 ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub chmod 644 ~/.ssh/known_hosts
权限过高会出错。

免密码登录
//将文件拷贝至远程服务器
scp ~/.ssh/id_rsa.pub root@<remote_ip>:pub_key

//将内容追加到authorized_keys文件中, 不过要登录远程服务器来执行这条命令
cat ~/pub_key >>~/.ssh/authorized_keys

编辑/etc/ssh/sshd_config文件,将PubkeyAuthentication yes行和AuthorizedKeysFile .ssh/authorized_keys的注释删掉.重启sshd服务.

使用docker运行GitLab的更多相关文章

  1. docker搭建gitlab,设置邮件提醒,并运行runner

    接着http://www.cnblogs.com/wsy1030/p/8431837.html 在另一台机子运行gitlab: docker run --name='gitlab' -d -p 222 ...

  2. docker下运行Gitlab CE+Jenkins+Nexus3+docker-registry-frontend

    DevOps - Gitlab CE - Jenkins - Nexus Gitlab CE https://hub.docker.com/r/gitlab/gitlab-ce/ https://do ...

  3. Windows10 上Docker 安装运行Gitlab

    准备条件 安装好Docker For Windows客户端. 配置好Docker 阿里云加速镜像地址. 检查Docker版本,大于等于v19. 拉取Gitlab镜像 docker pull gitla ...

  4. 备份docker运行的gitlab

    #!/bin/bash data=$(date "+%Y-%m-%d %H:%M:%S") gitBak='/data/gitlab/data/backups' delFile=` ...

  5. Docker学习系列(三)Docker搭建gitlab的两种方式

    一.直接下载docker-ce 1.拉取gitlab/gitlab-ce Randy:~ Randy$ docker pull gitlab/gitlab-ce Using default tag: ...

  6. Windows 下 docker 部署 gitlab ci

    一.安装 1. 安装 docker Docker下载 注意:Windows 10 家庭版获取 之前的版本不能直接安装 Docker ,而是需要去安装 Docker Toolbox 我这里安装的是 Do ...

  7. docker搭建gitlab服务器(Centos7)

    系统环境:CentOS Linux release 7.6.1810 (Core) git版本:gitlab/gitlab-ce 一.安装和启动docker 见HTTPRUNNERMANAGER安装部 ...

  8. Centos7使用docker搭建gitlab服务器

    了解到docker的优点,搭建快,运行要求资源低,最重要的是实现的功能和效果都能达到预期,于是决定使用docker来搭建gitlab服务器. 效果图如下: 系统环境:CentOS Linux rele ...

  9. Debian9 使用 Docker 安装 gitlab完整过程

    一. 安装Docker CE (参考 官网指南) 1. 卸载老版本 sudo apt-get remove docker docker-engine docker.io  2. Update the ...

随机推荐

  1. 距离北京奥运还有359天,发布WPF版本的北京2008标志(上)

    原文:距离北京奥运还有359天,发布WPF版本的北京2008标志(上) 效果图: XAML代码:<Canvas Width="343.581055" Height=" ...

  2. Delphi内存管理(Integer、Boolean、Record、枚举等都是在作用域内编译器自动申请内存,出了作用域自动释放;另外,字符串、Variant、动态数组、接口也是由Delphi自动管理)

    一.什么是堆.栈? 程序需要的内存空间分为 heap(堆) 和 stack(栈),heap 是自由存储区, stack 是自动存储区,使用 heap 需要手动申请.手动释放, stack 是自动申请. ...

  3. boost::bind应用示例

    // testBind.cpp : Defines the entry point for the console application. // #include "stdafx.h&qu ...

  4. 【Android先进】如何使用数据文件来保存程序

    在程序,有许多方法来存储和检索数据,本文,它描述了如何使用文件系统来保存数据编程和读取操作 我直接写了一个帮助类,进行文件的写入和读取操作 /** * 用于在文件里保存程序数据 * * @author ...

  5. Carthage 包管理工具,另一种敏捷轻快的 iOS & MAC 开发体验 | SwiftCafe 咖啡时光

    说起 iOS 开发的包管理,大家就不由得会想起 CocoaPods, 它确实是一个强大的工具.但这次咱们来关注另外一个包管理工具 Carthage,如果说 CocoaPods 像一个航母,一应俱全,坚 ...

  6. 读BeautifulSoup官方文档之html树的搜索(2)

    除了find()和find_all(), 这里还提供了许多类似的方法我就细讲了, 参数和用法都差不多, 最后四个是next, previous是以.next/previous_element()来说的 ...

  7. linux清除日志文件

    #!/bin/bash # 清除log文件 LOG_DIR=/var/log ROOT_UID= # $UID为0的时候,用户才具有root用户的权限 LINES= # 默认的保存行数 E_XCD= ...

  8. shell中特殊变量及if条件

    特殊变量: linux中shell变量$#,$@,$,$,$2的含义解释: 变量说明: $$ Shell本身的PID(ProcessID) $! Shell最后运行的后台Process的PID $? ...

  9. Delphi 导出数据至Excel的7种方法

    一; delphi 快速导出excel uses ComObj,clipbrd; function ToExcel(sfilename:string; ADOQuery:TADOQuery):bool ...

  10. CPU多核控速

    初学者很多对自己开发的软件使用硬件资源的时候并不注意,造成写出的东西不是很满意. 一般有两种情况: 1.写的都是同步单线程任务,不管你电脑有多少个核都不关我事 我就用你1个核所以不管怎么样都不会把CP ...