1. docker ps - a 查看当前gitlab 当前的id

2. docker exec -it gitlab /bin/bash 进入docker git 容器中【gitlab 注意可以上图中的name,也可以是id都可以的】,如下图

3.gitlab-rails console -e production 输入该指令,启动Ruby on Rails控制台,该过程启动较慢,启动后如下图:

3. user = User.where(id: 1).first 查找root 用户 ,如下图显示@root 说明 有root用户

4. 设置密码:【切记:密码是:数字+字母大小写组合,单独字母或者数字或者数字字母小写都不行。】
user.password = ' 你的密码 ' 设置新密码
user.password_confirmation= ' 确认你的密码 '

注意:
user.save 后返回是false,报错"Validation failed: Password must not contain commonly used combinations of words and letters " 提示:验证失败:密码不得包含常用的单词和字母组合 也就是说,密码中不能是全部是数字或者字母,是数字字母的组合,且字母不能都是小写字母,是字母大小写加数字的集合。
5. user.save! 返回true 成功

6. exit; 退出重新登录即可。 如下图,登录成功。
