docker Gitlab 初始化账号以及密码是什么呢

安装部署

自动备份

备份恢复

密码设置

这时,gitlab已经跑起来了,通过浏览器能正常访问了,那么问题来了,初始化的管理员账号是什么呢?是 root,那它的密码是什么呢?
我也不知道它的密码是多少,进容器里修改root的密码

谨记原则:复制命令敲回车

1. 进入容器

docker exec -it gitlab bash

2. 进入bin目录

 进入gitlab的bin目录

cd /opt/gitlab/bin

3. 执行命令  执行gitlab-rails console

gitlab-rails console

操作记录:

root@68ead3283ca0:/opt/gitlab/bin#  gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.5.0 (f8796c0836e) FOSS
 GitLab Shell: 13.22.0
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.4.1)
irb(main):001:0

4. 执行命令

找到root的用户,输入u=User.where(id:1).first,然后回车

u=User.where(id:1).first

操作记录:

irb(main):001:0> u=User.where(id:1).first
=> #<User id:1 @root>

5. 修改密码

修改password,输入u.password=‘12345678’,然后回车
执行命令

u.password_confirmation='12345678'

操作记录:

irb(main):003:0>  u.password_confirmation='12345678'
=> "12345678"

6. 确认密码

执行命令

u.password_confirmation='12345678'

操作记录:

irb(main):003:0>  u.password_confirmation='12345678'
=> "12345678"

7. 保存修改

保存修改,输入u.save,然后回车,等到输出true,这时,密码修改成功
执行命令

u.save
irb(main):004:0> u.save
Enqueued ActionMailer::MailDeliveryJob (Job ID: aefddd21-8386-465a-8bb8-d0373adef725) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fe8ca55a978 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true

8. 操作记录(全)

[root@localhost ~]# docker exec -it gitlab bash
root@68ead3283ca0:/# cd /opt/gitlab/bin
root@68ead3283ca0:/opt/gitlab/bin#  gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.5.0 (f8796c0836e) FOSS
 GitLab Shell: 13.22.0
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.4.1)
irb(main):001:0> u=User.where(id:1).first
=> #<User id:1 @root>
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::MailDeliveryJob (Job ID: aefddd21-8386-465a-8bb8-d0373adef725) to Sidekiq(mailers) with a:0x00007fe8ca55a978 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0> exit

9. 操作截图(全)

 

posted @ 2022-10-13 11:09  刘小吉  阅读(2769)  评论(2编辑  收藏  举报