官方教程 
https://docs.gitlab.com/omnibus/docker/

建议虚拟机内存2G以上

搜索镜像

docker search gitlab 

下载镜像文件

docker pull docker.io/gitlab/gitlab-ce


注意:一定要配置阿里云的加速镜像

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

mkdir -p /mnt/gitlab/etc
mkdir -p /mnt/gitlab/log
mkdir -p /mnt/gitlab/data

创建容器之前,我们先关闭下防火墙,重启docker服务

systemctl stop firewalld.service
firewall-cmd --state
systemctl daemon-reload
systemctl stop firewalld.service

运行GitLab容器 

docker run \
--detach \
--publish 2222:22 \
--publish 8090:80 \
--publish 8443:443 \
--hostname 192.168.56.3 \
-v /mnt/gitlab/etc:/etc/gitlab \
-v /mnt/gitlab/log:/var/log/gitlab \
-v /mnt/gitlab/data:/var/opt/gitla \
-v /etc/localtime:/etc/localtime:ro \
--name gitlab \
--restart always \
--privileged=true gitlab/gitlab-ce:latest

 运行成功之后,将挂载文件同步到容器外面

修改/mnt/gitlab/etc/gitlab.rb

把external_url改成部署机器的域名或者IP地址

vi /mnt/gitlab/etc/gitlab.rb

external_url 'http://192.168.56.3'

按 i 进行编辑,编辑好了按Esc,:wq 进行保存

修改/mnt/gitlab/data/gitlab-rails/etc/gitlab.yml

vi /mnt/gitlab/data/gitlab-rails/etc/gitlab.yml

找到关键字 * ## Web server settings *

按斜杠进行搜索

/Web server settings

我们进到目录再看一下挂载文件是否同步到外面来了

[root@localhost ~]# cd /mnt/gitlab/etc/
[root@localhost etc]# ls
gitlab.rb ssh_host_ecdsa_key ssh_host_ed25519_key ssh_host_rsa_key trusted-certs
gitlab-secrets.json ssh_host_ecdsa_key.pub ssh_host_ed25519_key.pub ssh_host_rsa_key.pub

这个时候我们把容器停止再删除,然后重启服务

[root@localhost ~]# docker stop 3f3d49ac7888aaf51d51761c27f92e4bf1b465f76b1a58f3428637b9c3ffd9b7
3f3d49ac7888aaf51d51761c27f92e4bf1b465f76b1a58f3428637b9c3ffd9b7
[root@localhost ~]# docker rm 3f3d49ac7888aaf51d51761c27f92e4bf1b465f76b1a58f3428637b9c3ffd9b7
3f3d49ac7888aaf51d51761c27f92e4bf1b465f76b1a58f3428637b9c3ffd9b7
[root@localhost ~]# systemctl restart docker
[root@localhost ~]#

再来重新创建容器

docker run \
--detach \
--publish 2222:22 \
--publish 8090:80 \
--publish 8443:443 \
--hostname 192.168.56.3 \
-v /mnt/gitlab/etc:/etc/gitlab \
-v /mnt/gitlab/log:/var/log/gitlab \
-v /mnt/gitlab/data:/var/opt/gitla \
-v /etc/localtime:/etc/localtime:ro \
--name gitlab \
--restart always \
--privileged=true gitlab/gitlab-ce:latest

这个时候我们来查一下,看一下容器有没有分配ip地址,有的话表示创建容器成功了。

[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d07898b3749d gitlab/gitlab-ce "/assets/wrapper" About a minute ago Up Less than a second (health: starting) 22/tcp, 0.0.0.0:8090->80/tcp, 0.0.0.0:8443->443/tcp gitlab
f264e5f1be41 sonatype/nexus3 "sh -c ${SONATYPE_DI…" 2 hours ago Up 2 hours 0.0.0.0:8081->8081/tcp nexus
[root@localhost ~]# docker inspect d07898b3749d

访问一下ip地址

[root@localhost ~]# curl 172.17.0.3:80
curl: (7) Failed connect to 172.17.0.3:80; Connection refused

拒绝连接,说明启动没有那么快,还需要一些时间

关闭防火墙,查看下状态,这个时候防火墙已经关闭了。

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]#

查看了下容器状态,发现gitlab一直是重启状态

[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUSPORTS NAMES
d07898b3749d gitlab/gitlab-ce:latest "/assets/wrapper" 19 minutes ago Restarting (1) 1 second ago gitlab

查看日志

sudo docker logs gitlab

错误就不在这里演示了,通过谷歌解决了我的问题,

解决好之后重启下服务跟gitlab

重新验证,好了

等个几分钟,重新刷新下页面

至此gitlab搭建成功了,历经千辛万苦。

CentOS7-Docker 安装 Gitlab详细篇的更多相关文章

  1. Centos7 docker安装GitLab

    *先决条件系统已安装Docker 1.查询GitLab镜像 docker search gitlab 2.现在GitLab镜像 3.创建文件夹 mkdir -p /software/gitlab/co ...

  2. Docker安装Gitlab

    一.Ubuntu16.4上Docker安装Gitlab 1.安装docker 参见:https://docs.docker.com/engine/installation/linux/ubuntuli ...

  3. docker安装gitlab并部署CICD

    摘要 本文主要实现了在docker下安装gitlab,将gitlab绑定在宿主机的180端口,将gitlab的clone的URL添加指定端口号:部署了CI/CD,并公布了测试项目. 安装docker[ ...

  4. centos7 部署安装gitlab服务器

    概念: git 是一种版本控制系统,是一个命令,是一种工具 gitlib 是用于实现git功能的开发库 github 是一个基于git实现的在线代码托管仓库,包含一个网站界面,向互联网开放 gitla ...

  5. 解决 Windows Docker 安装 Gitlab Volume 权限问题

    本文首发于我的个人博客,解决 Windows Docker 安装 Gitlab Volume 权限问题 ,欢迎访问! 记录一下 Windows10 下 Docker 安装 Gitlab 的步骤. Ca ...

  6. CentOS7离线安装Nginx(详细安装过程)

    CentOS7离线安装Nginx(详细安装过程) 1.安装gcc.g++ 下载好所需的文件后上传至服务器(下载地址:https://download.csdn.net/download/a729360 ...

  7. 利用docker安装gitlab

    安装docker 安装 virtualbox 下载 dockertoolbox并安装 官网的服务器一直连不上, 幸亏还有这个 https://get.daocloud.io/toolbox/ 比 ht ...

  8. centos7.3 安装oracle 详细过程

    centos7.3安装oracle详细过程1.下载Oracle安装包:linux.x64_11gR2_database_1of2.zip 和 linux.x64_11gR2_database_2of2 ...

  9. docker 安装gitlab

    # docker 安装gitlab # 一.安装镜像(官网文档) export GITLAB_HOME=/srv/gitlab # 必须先设置它,它就是你存储代码仓库的位置.以后要移植的时候直接把这个 ...

随机推荐

  1. 等待唤醒机制---Day25

    线程间通信 概念:多个线程在处理同一个资源,但是处理的动作(线程的任务)却不相同. 比如:线程A用来生成包子的,线程B用来吃包子的,包子可以理解为同一资源,线程A与线程B处理的动作,一个 是生产,一个 ...

  2. A MacFUSE-Based Process File System for Mac OS X

    referer: http://osxbook.com/book/bonus/chapter11/procfs/ Processes as Files The process file system  ...

  3. vue多个路由使用同一个页面,通过name判断参数,渲染页面数据

    项目中,发现有多个页面的数据内容相同,只是请求数据的参数不同,就可以使用同一个组件来渲染 这里的客户列表 / 我负责的 / 我参与的 都使用同一个组件,不同点在请求数据的参数 可以看到,通过钩子函数, ...

  4. InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's

    InvalidOperationException: Operations that change non-concurrent collections must have exclusive acc ...

  5. 【转载】QQ炫舞手游自制谱子教程(星动模式)

    第一步:计算ET和BPM: 抄送原作者部落链接:https://buluo.qq.com/p/detail.html?bid=368006&pid=981862-1529828677& ...

  6. Android开发:为什么你的学习效率如此低,为什么你很迷茫?

    一天一天的过的真的是太快了,常常感到时间在前进,而我们还在停滞不前,看似每天努力的工作学习着,仔细想想其实又会发现,一天下来我们好像还真的什么都没干,看似忙碌的一天,我们把时间都用在哪了?学习!可是为 ...

  7. 用纯真ip数据库.dat文件查询ip归属

    网址:http://www.cz88.net/ 下载安装后,有这个文件: 安装路径/ip/qqwry.dat 创建实例的时候吧这个文件路径传入,即可调用. /** * 从纯真IP地址库查询ip归属 * ...

  8. 可怕的Full GC (转自Hbase不睡觉书)

    PS:之前做项目的时候,需要做个复杂的查询,大量的查询总是导致hbase集群奔溃,最后定位到时full GC的原因. 以下转自<Hbase不睡觉书>-------------------- ...

  9. PostgreSQL 11 Partitioning Improvements

    转自:https://pgdash.io/blog/partition-postgres-11.html PostgreSQL 11, due to be released later this ye ...

  10. [RN] Android 设备adb连接后unauthorized解决方法

    Android 设备adb连接后unauthorized解决方法 安卓设备usb或者adbwireless连接后输入adb device后都是未授权状态 相信很多同学都会遇到这种情况,除了一直重复开关 ...