Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Docker Desktop for WindowsでWindows10からDockerコンテナにGit Bashでアクセス

Last updated at Posted at 2021-07-02

目的

Docker Desktop for Windowsで作成したGitlabのrootパスワードを変更したい。

対応方針

コンテナにターミナルを割り当てる事でLinuxのように操作ができます。
(Git BashからDockerで作成したGitLabコンテナにアクセス)
Dockerのコンテナにターミナルソフトでアクセスする方法 を参考にさせて頂きました。

Git Bashを起動(git bashを導入する方法は割愛)

XXXX@DESKTOP-BMGUJA8 MINGW64 /

コンテナにターミナルを割り当て

  1. dockerディレクトリに移動

私の環境では以下ディレクトリとなります。

C:\docker
  └─my_prot01 
$ cd c://docker/my_prot01

XXXX@DESKTOP-BMGUJA8 MINGW64 /c/docker/my_prot01
$ pwd
/c/docker/my_prot01
  1. winptyコマンド(※1)を使用してgit bashからコンテナにアクセス
XXXX@DESKTOP-BMGUJA8 MINGW64 /c/docker/my_prot01
$ winpty docker exec -it gitlab bash
root@gitlab:/#  ★切り替わる

※1
winptyコマンドについては、[Git Bash] winpty コマンドについて調べてみた を参考にさせて頂きました。

RilsConsoleを起動

root@gitlab:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
 GitLab:       14.0.1 (76b84b42f64) FOSS
 GitLab Shell: 13.19.0
 PostgreSQL:   12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0>  ★切り替わる

GitLabのパスワードを変更

GitLabのrootパスワード変更方法 に詳しく書かれているため、こちらのサイトを参考にして頂ければと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?