拉取镜像
docker pull gitlab/gitlab-ce:nightly
编写docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| version: '3.5' services: gitlab: image: gitlab/gitlab-ce:nightly container_name: test-gitlab restart: unless-stopped privileged: true environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | # #gitlab访问地址,可以写域名。如果端口不写的话默认为80端口 external_url 'http://labs.test.com:2333' # #ssh主机ip gitlab_rails['gitlab_shell_ssh_port'] = 1022 gitlab_rails['time_zone'] = 'Asia/Shanghai' # 头像图片处理 #gitlab_rails['gravatar_plain_url'] = 'http://sdn.geekzu.org/avatar/%{hash}?s=%{size}&d=identicon' gitlab_rails['gravatar_ssl_url'] = 'https://seccdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon' gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" # 是否开启nginx代理 此处必须true nginx['enable'] = true # https配置根据实际需求来配置, 如果是转发的https则可以不配置 nginx['redirect_http_to_https'] = false nginx['ssl_prefer_server_ciphers'] = "off" #nginx['ssl_certificate'] = "/etc/gitlab/ssl/labs.test.com.pem" #nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/labs.test.com.key" ports: - 2333:2333 - 443:443 - 1022:22 volumes: - /home/gitlab/config:/etc/gitlab - /home/gitlab/logs:/var/log/gitlab - /home/gitlab/data:/var/opt/gitlab - /home/gitlab/backups:/var/opt/gitlab/backups - /home/gitlab/etc:/etc/gitlab networks: default: external: true name: test
|
修改root密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| # 进入容器内部 docker exec -it gitlab /bin/bash
# 进入控制台 gitlab-rails console -e production
# 查询id为1的用户,id为1的用户是超级管理员 user = User.where(id:1).first # 修改密码为pdl123456 user.password='pdl123456' # 保存 user.save! # 退出 exit
|
问题
初始密码
1
| 在/etc/gitlab目录下面int_password
|
#日志报错Failed to get final advertise address: No private IP address found, and explicit IP not provided
在 /etc/gitlab/gitlab.rb文件末尾追加配置
1 2 3
| alertmanager['flags'] = { 'cluster.advertise-address' => "127.0.0.1:9093", }
|