How to Get root User Password of Gitlab Docker Container after running it in the first time

Posted on

How to Get root User Password of Gitlab Docker Container after running it in the first time

Introduction

This article will show how to get a root password of a root user accout. It is a root user account from a running Gitlab docker container. Actually, it is part of an article exist with the title of ‘How to Run Gitlab Docker Container in Microsoft Windows’ in this link. Basically, it is only for the first time after successfully install Gitlab in the local physical device. Furthermore, it can be also for the first time after running Gitlab docker container.

Get root User Password of Gitlab Docker Container after running it in the first time

Below are the steps for achieving it where the main purpose is retrieving the default password of root account for the freshly installed or run Gitlab service :

  1. First of all, just make sure that Gitlab is running. Try to access it using any web browser available. Then, type the address of the running Gitlab. Either it is running physically or virtually using Docker container for an example.

  2. Run any Command Line Interface available. In this context, it is using Windows PowerShell. If it is not, for an example any type of Linux distributions, it will have a different way. As for Gitlab which is running using Docker container, make sure to get inside to the Docker container before getting the default root password. Type the following to check the Gitlab docker container :

    C:\Users\Personal>docker container ls --all
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    0617572fd1d7 gitlab/gitlab-ee:latest "/assets/wrapper" 18 months ago Up 6 seconds (health: starting) 0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp gitlab
    
    C:\Users\Personal>
    
  3. Since this is a virtual docker container running Gitlab service, just get in to it to continue the process. Type the following commmand to do it :

    C:\Users\Personal>docker exec -it gitlab /bin/bash
    root@gitlab:/#

    In this context, ‘gitlab’ is the name of the Docker container running the Gitlab service.

  4. Following after, just type ‘cat /etc/gitlab/initial_root_passwrd’ as follows :

    C:\Users\Personal>docker exec -it gitlab /bin/bash
    root@gitlab:/# cat /etc/gitlab/initial_root_password
    #WARNING: This value is valid only in the following condiions
    # 1. If provided manually (either via 'GITLAB_ROOT_PASSWORD' environment variable or via 'gitlab_rails['initial_root_password']' setting in 'gitlab.rb',it was provided before database was seeded for the first time (usually, the first reconfigure run).
    # 2. Password hasn't been changed manually, either via UI or via command line.
    # If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
    
    Password : kV71TBa0X51kZBRIuJV/obXXzeW43kZvnm8tu*UrLI=
    #NOTE : This file will be automatically deleted in the first reconfigure run after 24 hours.
    root@gitlab:/#
    
  5. Last but not least, copy the password as available in the output of the command execution above.

Just take a look at the following video content to be able to do or to perform the above steps :

Leave a Reply