Docker Gitlab change forgotten root password

15,161

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

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

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/

Share:
15,161
hannes ach
Author by

hannes ach

Updated on June 13, 2022

Comments

  • hannes ach
    hannes ach almost 2 years

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

  • panc
    panc over 2 years
    I 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
    David Farrell over 2 years
    This 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
    marc.guenther about 2 years
    Worked perfectly! It is so annoying that is this not easily found in the official documentation.