Gitlab--安装配置使用

一、gitlab安装

1.1、docker化安装gitlab

#1、拉取镜像
[ ~]# docker pull gitlab/gitlab-ce
[ ~]# docker images
REPOSITORY                                       TAG                 IMAGE ID            CREATED             SIZE
gitlab/gitlab-ce                                 latest              229b36075891        3 days ago          1.84GB

#2、创建相关目录
[ ~]# mkdir -p /mnt/gitlab/etc
[ ~]# mkdir -p /mnt/gitlab/log
[ ~]# mkdir -p /mnt/gitlab/data

#3、运行容器
[ ~]# docker run -d  -p 443:443 -p 80:80 -p 222:22 --name gitlab --restart always -v /mnt/gitlab/etc:/etc/gitlab -v /mnt/gitlab/logs:/var/log/gitlab -v /mnt/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
[ ~]# docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                                 PORTS                                                           NAMES
3694c2292ed0        gitlab/gitlab-ce    "/assets/wrapper"   About a minute ago   Up About a minute (health: starting)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:222->22/tcp   gitlab

#4、配置gitlab
[ ~]# vim /mnt/gitlab/etc/gitlab.rb
external_url ‘http://192.168.11.10‘   # 配置http协议所使用的访问地址,不加端口号默认为80
#配置ssh协议所使用的访问地址和端口
gitlab_rails[‘gitlab_ssh_host‘] = ‘192.168.11.10‘ 
gitlab_rails[‘gitlab_shell_ssh_port‘] = 222

#5、重启容器
[ ~]# docker restart gitlab
gitlab

#6、访问测试