Setting Up A Local GitLab Repository For CI/CD On Docker Container Using Docker Desktop For Windows
Below are the steps to set up the gitlab repository CICD tool locally on windows machine on a docker container
Pre-requisites:
- Install & Start Docker Desktop For Windows
- Windows 10
Steps:
- Create following directories on filesystem:
a) GitLab home directory→ C:\gitlab-local
2. Create following environment variable on windows:
GITLAB_HOME = C:\gitlab-local
3. Execute following command on powershell to run gitlab-ce image as a docker container
docker run --detach `
--hostname gitlab.example.com `
--publish 443:443 --publish 80:80 --publish 22:22 `
--name gitlab `
--restart always `
--volume $GITLAB_HOME/config:/etc/gitlab `
--volume $GITLAB_HOME/logs:/var/log/gitlab `
--volume $GITLAB_HOME/data:/var/opt/gitlab `
--shm-size 2gb `
--env GITLAB_ROOT_PASSWORD `
gitlab/gitlab-ce:latest
4. Make an entry in the hostfile
127.0.0.1 gitlab.example.com
5. Open the following link in the browser:
http://gitlab.example.com
6. GitLab Starts Up
The container takes sometime to start up and change to healthy status
Initially following page is visible when the gitlab container starts up
7. GitLab Login Screen
After successful container start up, following login screen opens up
GitLab creates following directories on filesystem
a) For storing GitLab configuration files : C:\gitlab-local\configb) For storing application data : C:\gitlab-local\datac) For storing logs : C:\gitlab-local\logs
Exec into the gitlab container
docker exec -it gitlab sh
8. GitLab Login Credentials
Username = rootPassword = <value of password in initial_root_password file>
9. Login to GitLab Console