I am running GitLab and Gitlab-Runner docker instances locally. When a Spring Boot and Maven project pipeline is executed, I am getting below error.
Getting source from Git repository
00:02
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/root/starter-springboot-pipeline/.git/
fatal: unable to access 'http://localhost/root/starter-springboot-pipeline.git/': Failed to connect to localhost port 80: Connection refused
Uploading artifacts for failed job
00:07
ERROR: Job failed: exit code 1
Not sure if the localhost in the above error is referring to GitLab container or Runner container. Should it refer to the gitlab container and not the localhost?
Below are the commands and configuration I used.
Start the GitLab server:
docker run -itd --network=gitlab-network --hostname localhost \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab --restart always --volume config:/etc/gitlab \
--volume logs:/var/log/gitlab \
--volume data:/var/opt/gitlab \
gitlab/gitlab-ee:12.10.14-ee.0
Start the GitLab Runner
docker run -d --name gitlab-runner --restart always \
-v ~/gitlab/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:v12.10.3
Created Network 'gitlab-network' and added both containers to it.
docker network connect gitlab-network gitlab
docker network connect gitlab-network gitlab-runner
Registered the Runner as below:
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab
Please enter the gitlab-ci token for this runner:
XxXXxXXXxxXXXXXX
Please enter the gitlab-ci description for this runner:
[49ad685039ad]: runner14
Please enter the gitlab-ci tags for this runner (comma separated):
docker
Registering runner... succeeded runner=EkWnb63h
Please enter the executor: docker-ssh, parallels, shell, virtualbox, docker+machine, kubernetes, custom, docker, ssh, docker-ssh+machine:
docker
Please enter the default Docker image (e.g. ruby:2.6):
alpine:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
Below is the gitlab-ci.yml
image: maven:3.3-jdk-8
stages:
- test
test_job:
stage: test
script:
- pwd
- mvn clean
- mvn compile
- mvn test
tags:
- docker
I have newly started working on GitLab and docker, able to setup them and run the pipeline after resolving some issues with good amount of research. But I am stuck with this issue.