Create GitLab Environment For Testing.

Maciej
2 min readFeb 23, 2022
Photo by John O’Nolan on Unsplash

Introduction

I want to prepare a minimal, reconstructable and disposable GitLab environment for checking operation and data migration. It does not foresee that it will be used by other users in actual work.

Setup

In official documentation there is description how setup GitLab on Docker

It not will be a production operation, it is just a local verification test and data migration, so http://localhost:8081. I think that Docker Desktop for is often used in the verification environment, docker-compose.yml. In this case, docker-compose can be used from the beginning, so it is easier than specifying options .

docker-compose.yaml

  • Create directory
root@vagrant:/home/vagrant# mkdir -p /opt/gitlab
  • Specify the path of the volume to be persisted
root@vagrant:/home/vagrant# export GITLAB_HOME=/opt/gitlab
  • Run docker compose
root@vagrant:/home/vagrant# docker-compose up -d

After that, wait for a while, check the startup in the log, access with a browser and change the administrator password. We can find this in easy way.

root@vagrant:/home/vagrant# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
35024e1396aa gitlab/gitlab-ce:latest "/assets/wrapper" 10 minutes ago Up 10 minutes (healthy) 22/tcp, 80/tcp, 443/tcp, 0.0.0.0:8080->8081/tcp, :::8080->8081/tcp vagrant_web_1
root@vagrant:/home/vagrant# docker exec -it vagrant_web_1 grep 'Password:' /etc/gitlab/initial_root_password

Now we can open URL http://HOST-IP:8080/ and change password, default login is root.

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.