Resources
Installing GitLab on WSL 2 container running on Docker Desktop for Windows
* Install Windows feature “Windows Subsystem for Linux” (Start > Turn Windows features on or off > check “Windows Subsystem for Linux”).
- Install Windows feature “Virtual Machine Platform” (Start > Turn Windows features on or off > check “Virtual Machine Platform”).
-
Reboot system
-
Install the Linux kernel update package (https://docs.microsoft.com/nl-nl/windows/wsl/install-win10#step-4—download-the-linux-kernel-update-package)
-
Reboot system
-
Set WSL 2 as your default version (wsl –set-default-version 2)
-
Install your Linux distribution of choice (https://www.microsoft.com/nl-nl/p/ubuntu-2004-lts/9n6svws3rx71?rtc=1&activetab=pivot:overviewtab)
- Install Docker desktop on Windows (https://docs.docker.com/desktop/windows/install/)
Follow the step found on https://docs.gitlab.com/ee/install/docker.html
Summary:
- Add environment variable GITLAB_HOME = “C:\GitLab” on Windows
-
Add inbound Windows firewall rule “Port” > TCP – 8080 > Name = TCP – 8080 – GITLAB
-
Add inbound Windows firewall rule “Port” > TCP – 4430 > Name = TCP – 4430 – GITLAB
-
Add outbound Windows firewall rule “Port” > TCP – 8080 > Name = TCP – 8080 – GITLAB
-
Add outbound Windows firewall rule “Port” > TCP – 4430 > Name = TCP – 4430 – GITLAB
-
Install Ubuntu-20.04 from Microsoft Store
-
Enable integration with additional distros in Docker Desktop for Windows (Settings > Resources > WSL INTEGRATION > Check “Enable integration with my default WSL distro
Check Ubuntu-20.04
-
Reboot system
-
Create docker compose file in ‘FolderContainingDockerComposeYml’:
web:
image: ‘gitlab/gitlab-ee:latest’
name: ‘gitlab’
restart: always
hostname: ‘dev-gitlab.nl’
ports:
- '8080:80'
- '4430:443'
- '22:22'
NOTE: On Windows don’t use GITLAB_OMNIBUS_CONFIG, else GitLab won’t work
GITLAB_OMNIBUS_CONFIG: |
external_url ‘dev-gitlab.nl’
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
NOTE: On Windows don’t use volumes, like described below. Let the Docker Desktop automatically create a volume, else GitLab won’t work.
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
Adjust host file (C:\Windows\System32\drivers\etc\hosts)
127.0.0.1 dev-gitlab.nl # GitLab in a container runnen on Docker desktop on Windows
On a PowerShell administrator prompt:
Set-Location “C:\FolderContainingDockerComposeYml”
docker-compose up -d
Note: you must wait at least 30 minutes before opening a browser on the host and visit the URL http://dev-gitlab.nl:8080
Or check the container output (when it stops outputing data for 2 minutes, you can try to access the gitlab url).
Log in with username ‘root’ and the password from the following command on a PowerShell commandline:
docker exec -it gitlab grep ‘Password:’ /etc/gitlab/initial_root_password
The password file will be automatically deleted in the first reconfigure run after 24 hours.