linux docker安装 gitlab后忘记root密码如何找回

复制代码
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; 退出重新登录即可。 如下图,登录成功。
相关推荐
顺风尿一寸2 小时前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
lichenyang4537 小时前
Docker 学习笔记(五):Docker Compose,用一个 YAML 启动前端、后端和 MongoDB
docker
lichenyang4538 小时前
Docker 学习笔记(四):Dockerfile,把项目打成自己的镜像
docker·容器
lichenyang4538 小时前
Docker 学习笔记(三):Docker 网络、bridge、子网和容器互通
docker·容器
lichenyang4538 小时前
Docker 学习笔记(二):docker run 的参数到底在控制什么?
docker·容器
XIAOHEZIcode8 小时前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫10 小时前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao2 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
戴为沐3 天前
Linux内存扩容指南
linux
zylyehuo4 天前
Linux 彻底且安全地删除文件
linux