当前位置: 代码迷 >> 综合 >> docker-compose 安装 gitlab
  详细解决方案

docker-compose 安装 gitlab

热度:36   发布时间:2023-11-09 17:51:40.0

目录

[root@junmo gitLab]# tree -L 1
.
├── config
├── data
├── gitLab.yml
├── logs
└── pass.txt3 directories, 2 files
[root@junmo gitLab]# 

docker-compose.yml 文件

version: '2'
services:gitlab:image: twang2218/gitlab-ce-zhrestart: alwayshostname: gitlab # 会把gitlab写入/etc/hosts,映射到主机IPcontainer_name: gitlabprivileged: true  # 特权模式ports:- 9080:80- 9443:9443- 58522:58522- 9022:9022volumes:- ./config:/etc/gitlab- ./data:/var/opt/gitlab- ./logs:/var/log/gitlabenvironment:TZ: 'Asia/Shanghai'GITLAB_OMNIBUS_CONFIG: |# 此处不要写宿主机IP,否则无法打开ui界面external_url 'http://gitlab' # 对外暴露地址,此处的 gitlab 就是上面 hostname属性值gitlab_rails['time_zone'] = 'Asia/Shanghai'gitlab_rails['gitlab_shell_ssh_port'] = 58522gitlab_rails['smtp_enable'] = truegitlab_rails['smtp_address'] = "smtp.163.com"gitlab_rails['smtp_port'] = 465gitlab_rails['smtp_user_name'] = "XXXX@163.com"   # 自己的邮箱gitlab_rails['smtp_password'] = "XXXXX"    # 自己的邮箱的密码gitlab_rails['smtp_domain'] = "163.com"gitlab_rails['smtp_authentication'] = "login"gitlab_rails['smtp_enable_starttls_auto'] = truegitlab_rails['smtp_tls'] = truegitlab_rails['gitlab_email_from'] = 'XXXX@163.com'  # 自己的邮箱

启动

docker-compose -f mongodb.yml up -d   # 启动
docker-compose -f mongodb.yml down    # 关闭
docker-compose -f mongodb.yml restart # 重启

注意

访问 IP:9080
启动太慢,等待时间太长

docker 安装gitlab

docker run -d  --hostname=localhost --restart=always \
--name gitlab --privileged=true \
-p 9443:443 -p 9080:80 -p 9022:22 -p 58522:58522 \
-v /opt/softs/docker-compose/gitLab/config:/etc/gitlab:Z  \
-v /opt/softs/docker-compose/gitLab/logs:/var/log/gitlab:Z \
-v /opt/softs/docker-compose/gitLab/data:/var/opt/gitlab:Z \
twang2218/gitlab-ce-zh
  相关解决方案