1. はじめに
- Windows環境でGitLab環境を構築した
- Dockerを使用してを環境を簡単に構築したい
2. 開発環境
- Windows 10
- Docker Desktop
- Docker Compose
- GitLab EE
3. Docker Desktopのインストール
3.1. インストーラーを起動し、ソフトウェアをインストールする
Docker Desktop Installer.exe
3.2. Docker Desktop起動時に、「Docker Desktop requires a newer WSL kernel version」が表示された場合
- WSL Linux カーネルを更新する。
wsl_update_x64.msi
4. Docker Composeのインストール
4.1. PowerShellを管理者権限で起動する
4.2. 下記コマンドよりインストールする
Invoke-WebRequest "https://github.com/docker/compose/releases/download/v2.19.0/docker-compose-windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\docker\docker-compose.exe
4.3. 下記コマンドよりインストールを確認する
docker-compose --version
5. GitLabのインストール
5.1. 事前準備
- 下記フォルダを準備する
C:\Docker\GitLab-ee
- config
- data
- logs
5.2. docker-compose.yamlの作成
- 下記ファイルを新規作成し、GitLab-ee直下に配置する
version: '3.6'
services:
gitlab:
container_name: 'gitlab2'
image: 'gitlab/gitlab-ee:latest'
restart: always
ports:
- '8080:80'
- '2222:22'
# 最初のPort番号で受けてDokcerへ後のPort番号で繋ぐ
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://[IPアドレス]:8080' ※IPアドレスは任意に変更する
gitlab_rails['gitlab_shell_ssh_port'] = 2222
nginx['listen_port'] = 80
# Add any other gitlab.rb configuration here, each on its own line
volumes:
- 'C:\Docker\GitLab\config:/etc/gitlab'
- 'C:\Docker\GitLab\logs:/var/log/gitlab'
- 'C:\Docker\GitLab\data:/var/opt/gitlab'
shm_size: '256m'
5.3. GitLabのインストール
- Docker Desktopを起動する
- PowherShellを管理者権限で起動する
- 下記コマンドでインストールを実行する
docker compose up -d
- 下記コマンドを実行状況を確認する
docker ps -a
- ブラウザで下記URLを開く
http://[IPアドレス]:8080
- Docker Desktopのターミナルからrootパスワードを確認する
cat /etc/gitlab/initial_root_password
6. Dockerコンテナの停止、削除方法
6.1. コンテナ停止
docker stop <コンテナ名>
6.2. コンテナ削除
docker rm <コンテナ名>
7. 参考文献