docker run --detach --hostname gitlab --publish 443:443 --publish 8011:80 --publish 2222:22 --name gitlab --restart always -v /srv/gitlab/config:/etc/gitlab -v /srv/gitlab/logs:/var/log/gitlab -v /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:latest
firewall-cmd --zone=public --add-port=8011/tcp --permanent
firewall-cmd --zone=public --add-port=2222/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
切换目录:cd /opt/gitlab/bin
执行 gitlab-rails console production 命令 开始初始化密码
gitlab-rails console
Loading production environment (Rails 6.1.3.2)
irb(main):001:0>
修改管理员密码: NOTE: 记得需要设置2次密码。第一次输入密码,第二次确认密码
irb(main):002:0> u=User.where(id:1).first
=> #<User id:1 @root>
irb(main):007:0> u.password=12345678
=> 12345678
irb(main):008:0> u.password_confirmation=12345678
=> 12345678
irb(main):009:0> u.save
Enqueued ActionMailer::MailDeliveryJob (Job ID: 2cc5555c-e78f-4865-9be4-89da0d838278) to Sidekiq(mailers) with arguments: “DeviseMailer”, “password_change”, “deliver_now”, {:args=>[#<GlobalID:0x00007f4a85ecbae0 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
到这里,root密码已经改成了12345678