Gitlab 構築したのに初期のパスワードが分からない!
ユーザー名
root
です。
パスワードの調べ方
コンテナの中に入る
まず、コンテナ名を調べます。
コンテナ名は、docker-compose.yml ファイルに書いてあります。
>> cat docker-compose.yml
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.202.129:9010'
gitlab_rails['gitlab_shell_ssh_port'] = 2022
nginx['listen_port'] = 9010
ports:
- '9010:9010'
- '2022:22'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
services の下の、gitlab
がサービス名です。
>> docker-compose exec コンテナ名 bash
で、コンテナの中に入ることができます。
>> docker-compose exec gitlab bash
パスワードを見る
/etc/gitlab/initial_root_password の中に初期パスワードがあります。
>> cat etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 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: WJrcFdGUAt9ch4/kosu0itIaqjWmji+3fHkMr8ytNA0=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
このファイルは 1 日で消えてしまうので注意してください!!
簡単な見方
docker-compose.yml があるディレクトリ内で、
>> docker-compose exec (コンテナ名) cat /etc/gitlab/initial_root_password
今回は以下
>> docker-compose exec gitlab cat /etc/gitlab/initial_root_password
# docker-compose exec gitlab cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 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: WJrcFdGUAt9ch4/kosu0itIaqjWmji+3fHkMr8ytNA0=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.