Background
I’ve read this post, and it seems that’s not applying in my specific case.
I’m running gitlab in docker with command:
sudo docker pull gitlab/gitlab-ce
mkdir -pv /data/gitlab
sudo docker run --detach \
--hostname 192.168.86.1 \
--shm-size 1024m \
-p 50443:443 \
-p 50080:80 \
-p 50022:22 \
--name gitlab \
--restart always \
-v /data/gitlab/config:/etc/gitlab \
-v /data/gitlab/logs:/var/log/gitlab \
-v /data/gitlab/data:/var/opt/gitlab \
-v /etc/localtime:/etc/localtime \
gitlab/gitlab-ce:latest
I can access it after installation via http://192.168.86.1:50080/
For the runner, I follow the instruction from gitlab, and installed it in a KVM machine:
# Download the binary for your system
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
# Give it permission to execute
sudo chmod +x /usr/local/bin/gitlab-runner
# Create a GitLab Runner user
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
# Install and run as a service
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
And registered it:
sudo gitlab-runner register --url http://192.168.86.1:50080/ --registration-token GR1348941zXXXXX
And with config.toml
:
$ sudo cat /etc/gitlab-runner/config.toml
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab runner in kvm"
url = "http://192.168.86.1:50080/"
id = 1
token = "GR1348941zXXXXX
token_obtained_at = 2023-03-27T07:47:27Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
[[runners]]
name = "ub01"
url = "http://192.168.86.1:50080/"
id = 2
token = "m-wUqDXXXXX"
token_obtained_at = 2023-03-28T02:22:53Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
[runners.cache]
MaxUploadedArchiveSize = 0
But got errors when running CI:
Running with gitlab-runner 15.10.0 (456e3482)
on ub01 m-wUqDPy, system ID: s_e36d739109b2
Preparing the "shell" executor
00:00
Using Shell (bash) executor...
Preparing environment
00:00
Running on ub01...
Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Initialized empty Git repository in /home/gitlab-runner/builds/m-wUqDPy/0/dev/tests/.git/
Created fresh repository.
fatal: repository 'http://192.168.86.1/dev/tests.git/' not found
ERROR: Job failed: exit status 1
PS
I did try to change the external_url
field in gitlab.rb
, but then gitlab web page failed to load.
external_url 'http://192.168.86.1:50080'