- 拉取镜像
docker pull gitlab/gitlab-ce - 运行
docker run --detach \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name 'gitlab-ce' \
--restart always \
--volume /opt/gitlab/config:/etc/gitlab \
--volume /opt/gitlab/logs:/var/log/gitlab \
--volume /opt/gitlab/data:/var/opt/gitlab/ \
--shm-size 256m \
gitlab/gitlab-ce
- 编辑配置
vi /opt/gitlab/config/gitlab.rb 找到本机地址,然后添加 external_url 'http://192.168.199.231' 配置ssh协议所使用的访问地址和端口 gitlab_rails['gitlab_ssh_host'] = '192.168.199.231' 如果修改了端口, 则添加一行 22端口映射的端口 gitlab_rails['gitlab_shell_ssh_port'] = 10022 - 访问对应地址,获取root用户密码
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
- 使用root登录即可
二、内存占用
如果希望内存占用相对较少则,旧版本使用 /unicorn 找到 worker_processes 设置为工作的人数即可;
unicorn['worker_processes'] = 2
新版则全部替换成puma,使用 /puma 找到对应地方,取消注释或者直接新增行
puma[‘enable’] = true
puma[‘worker_timeout’] = 60
puma[‘worker_processes’] = 2
puma[‘max_threads’] = 4
puma[‘per_worker_max_memory_mb’] = 1024
sidekiq[‘max_concurrency’] = 16
postgresql[‘shared_buffers’] = “256MB”
postgresql[‘max_worker_processes’] = 8
三、重置管理员密码
docker exec -it ad9b8c3e20f0 /bin/bash 进入cd /opt/gitlab/bin
root@47: gitlab-rails console
Loading production environment (Rails 4.2.10)
irb(main):001:0> u=User.where(id:1).first
=>
irb(main):002:0> u.password='12345678'
=> "12345678"
irb(main):003:0> u.password_confirmation='12345678'
=> "12345678"
irb(main):004:0> u.save
Enqueued ActionMailer::DeliveryJob (Job ID: 86227e1d-cc49-44de-9179-e7c20a8b03f6) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0>
|