Docker Gitlab change forgotten root password
Solution 1
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
docker exec -it d0bbe0e1e3db bash
<-- with your CONTAINER_ID
$ gitlab-rails console -e production
user = User.where(id: 1).first
user.password = 'your secret'
user.password_confirmation = 'your secret'
user.save
exit
Solution 2
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.
Solution 3
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/
hannes ach
Updated on June 13, 2022Comments
-
hannes ach almost 2 years
I'm running my Gitlab with Docker and I forgot my Gitlab root password. How to change it ?
-
panc over 2 yearsI was not able to login after using this method to update root password. After login the container's terminal, instead of using this method, I update the root password by using the command
gitlab-rake "gitlab:password:reset[root]"
. (reference). -
David Farrell over 2 yearsThis worked perfectly for me, so thanks for sharing! You were right about being patient, took ~40 seconds to show the prompt in my local dev
-
marc.guenther about 2 yearsWorked perfectly! It is so annoying that is this not easily found in the official documentation.