Centos7:Docker安装Gitlab

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

[root@master ~]# docker search gitlab 
INDEX       NAME                                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/gitlab/gitlab-ce                             GitLab Community Edition docker image base...   1784                 [OK]
docker.io   docker.io/sameersbn/gitlab                             Dockerized gitlab web server                    1022                 [OK]
docker.io   docker.io/gitlab/gitlab-runner                         GitLab CI Multi Runner used to fetch and r...   311                  [OK]
docker.io   docker.io/twang2218/gitlab-ce-zh                       汉化的 GitLab 社区版 Docker Image                     99                   [OK]
docker.io   docker.io/gitlab/gitlab-ee                             GitLab Enterprise Edition docker image bas...   89                   
docker.io   docker.io/jangrewe/gitlab-ci-android                   GitLab CI image for building Android apps       36                   [OK]
docker.io   docker.io/centurylink/gitlab                           This image uses the image from sameersbn /...   24                   [OK]
docker.io   docker.io/gitlab/dind                                                                                  21                   [OK]
docker.io   docker.io/cdrx/rancher-gitlab-deploy                   Painless deployment of projects built with...   19                   [OK]
docker.io   docker.io/edbizarro/gitlab-ci-pipeline-php             Build and test PHP applications with Gitla...   9                    
docker.io   docker.io/klud/gitlab-runner                           GitLab Runner for ARM devices                   8                    
docker.io   docker.io/ciricihq/gitlab-sonar-scanner                Gitlab Docker container to run sonar-scann...   5                    [OK]
docker.io   docker.io/gitlab/gitlab-runner-helper                                                                  5                    
docker.io   docker.io/gitlab/cog                                   GitLab Bundle for Cog                           3                    
docker.io   docker.io/dockerphp/gitlab-ci-pipeline                 Gitlab CI pipeline for PHP applications         2                    [OK]
docker.io   docker.io/adamkl/gitlab-merge-request-resource         Customized with support for gitlab ssh on ...   1                    [OK]
docker.io   docker.io/benyoo/gitlab                                基于sameersbn/gitlab:8.9.4和GitLab 中䬮.           1                    [OK]
docker.io   docker.io/gotfix/gitlab                                Dockerized Gitlab with a lot of configurab...   1                    
docker.io   docker.io/mastertinner/gitlab-merge-request-resource   A concourse resource to check for new merg...   1                    [OK]
docker.io   docker.io/primetoninc/gitlab                           gitlab-ce                                       1                    [OK]
docker.io   docker.io/sgillespie/gitlab-runner                     A Dockerized GitLab Runner that automatica...   1                    [OK]
docker.io   docker.io/gitlab/gitlab-qa                             GitLab QA has a test suite that allows end...   0                    
docker.io   docker.io/instrumentisto/gitlab-builder                Docker image with minimal toolchain requir...   0                    [OK]
docker.io   docker.io/sicony/npm-cache-gitlab-mr                   Concourse CI npm cache resource for gitlab...   0                    
docker.io   docker.io/stanfordlegion/gitlab-ci                     An image for Gitlab CI.                         0                    [OK]
[root@master ~]#
[root@master ~]# docker pull docker.io/gitlab/gitlab-ce
Using default tag: latest
Trying to pull repository docker.io/gitlab/gitlab-ce ... 
latest: Pulling from docker.io/gitlab/gitlab-ce
22dc81ace0ea: Pull complete 
1a8b3c87dba3: Pull complete 
91390a1c435a: Pull complete 
07844b14977e: Pull complete 
b78396653dae: Pull complete 
b7b27b5a862c: Pull complete 
b36426107b6c: Pull complete 
3368a63e7ee5: Pull complete 
9af48542e108: Pull complete 
89277d2aced7: Pull complete 
023bfed27041: Pull complete 
Digest: sha256:194d10fcb9421517ce739fb837d8b015bb9154969466e62b0ab057264f063f58
[root@master ~]# 

在服务器上创建目录

[root@master ~]# mkdir -p /docker/gitlab/config
[root@master ~]# mkdir -p /docker/gitlab/logs
[root@master ~]# mkdir -p /docker/gitlab/data
docker run  
   -d \
   -h gitlab \
   -p 2222:22 \
   -p 8888:80 \
   -p 8443:443 \
   -v /docker/gitlab/config:/etc/gitlab \
   -v /docker/gitlab/logs:/var/log/gitlab \
   -v /docker/gitlab/data:/var/opt/gitlab \
   --restart always \
   --name gitlab \
   gitlab/gitlab-ce:latest

参数说明:

--detach: 设置容器后台运行
--hostname: 设置容器的 hostname
--publish: 端口转发规则(80Http 访问端口,443Https 访问端口,8888:主机的 ssh 访问端口,22Docker 容器中 ssh 访问端口)
--name:容器名称
--restart always:每次启动容器就重启GitLab
--volume: 共享目录挂载,即 docker 容器内外数据共享(/srv/gitlab/data: 应用程序数据,/srv/gitlab/logs:GitLab 的 log,/srv/gitlab/config:GitLab 的配置文件)
--e:配置 Gitlab 运行的环境变量
[root@master ~]# docker run  -d \
> -h gitlab \
> -p 2222:22 \
> -p 8888:80 \
> -p 8443:443 \
> -v /docker/gitlab/config:/etc/gitlab \
> -v /docker/gitlab/logs:/var/log/gitlab \
> -v /docker/gitlab/data:/var/opt/gitlab \
> --restart always \
> --name gitlab \
> gitlab/gitlab-ce:latest
735b8de9827a615cb69392f542acc33e4fecec998256af62eb9a36e8733cae12
[root@master ~]#

错误信息:502 Whoops, GitLab is taking too much time to respond.
Centos7:Docker安装Gitlab_第1张图片

说明gitlab还没有准备好,再等待一会,刷新浏览器,即可看到如下页面
Centos7:Docker安装Gitlab_第2张图片

初次使用gitlab时需要创建默认管理员密码,至少8位,这里输入“12345678”。
我们在登录那里使用root作为用户名,然后用刚刚设置的密码,就可以以管理员身份登录Gitlab。
Centos7:Docker安装Gitlab_第3张图片

然后我们需要注册一个普通用户。
Centos7:Docker安装Gitlab_第4张图片

你可能感兴趣的:(Docker学习笔记)