Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Gitlab change forgotten root password

I'm running my Gitlab with Docker and I forgot my Gitlab root password. How to change it ?

like image 906
hannes ach Avatar asked Apr 18 '19 13:04

hannes ach


3 Answers

I found a way to make it work. First connect to your Gitlab with command line

search for your Docker CONTAINER_ID

docker ps -all

eg

enter image description here

docker exec -it d0bbe0e1e3db bash <-- with your CONTAINER_ID

$ gitlab-rails console -e production

enter image description here

user = User.where(id: 1).first
user.password = 'your secret'
user.password_confirmation = 'your secret'
user.save
exit
like image 128
hannes ach Avatar answered Nov 11 '22 22:11

hannes ach


The new-ish hotness to change Gitlab's "root" account's password is this:

gitlab-rake "gitlab:password:reset[root]"

And if you're running Gitlab inside a Docker container, then use this from the host (you may have to "sudo" this depending on your situation):

docker exec -it gitlab gitlab-rake "gitlab:password:reset[root]"

This assumes that you named your Gitlab container "gitlab". And be patient; don't be surprised if it takes more than a few seconds before the "Enter password:" prompt shows up.

like image 28
Granger Avatar answered Nov 11 '22 22:11

Granger


I leave a tutorial updated to the new version. In my case it is for a Gitlab installation on a Synology.

Translate (Spanish -> English ) https://translate.google.com/translate?sl=es&tl=en&u=https://www.vicolinker.net/synology-gitlab-reset-root-password/

Original (Spanish) https://www.vicolinker.net/synology-gitlab-reset-root-password/

like image 1
victorelec14 Avatar answered Nov 11 '22 22:11

victorelec14