Describe your question in as much detail as possible:
I have the following docker-compose file:
version: "3.8"
services:
gitlab:
image: gitlab/gitlab-ce:16.2.3-ce.0
container_name: gitlab
hostname: 'gitlab'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab'
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- gitlab_config:/etc/gitlab
- gitlab_logs:/var/log/gitlab
- gitlab_data:/var/opt/gitlab
networks:
- gitlab_net
gitlab-runner:
image: gitlab/gitlab-runner:v16.2.1
container_name: gitlab-runner
depends_on:
gitlab:
condition: service_healthy
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- gitlab_runner_config:/etc/gitlab-runner
networks:
- gitlab_net
volumes:
gitlab_config:
gitlab_logs:
gitlab_data:
gitlab_runner_config:
networks:
gitlab_net:
driver: bridge
I start it via ‘docker-compose up -d’
When everything is running properly I will create a gitlab-runner service by following the instructions from http://localhost/root/testproject/-/settings/ci_cd under the section of Runners, and creating a new runner via instructions from http://localhost/root/testproject/-/runners/new. After the runner is created I will register it with gitlab-runner register
command from the gitlab-runner container with the http://gitlab
as host and with the generated token.
After everything is done the runner is will start and when I run a new Pipeline I will get this error message:
Running with gitlab-runner 16.2.1 (674e0e29)
on some_name_haha gWk8TaDTq, system ID: r_CjEBwP0lDBwE
Preparing the "docker" executor 00:03
Using Docker executor with image gcc ...
Pulling docker image gcc ...
Using docker image sha256:624c09f87a46c96ac13134027ece28486b7917dfed23cf90d96cae83521d7998 for gcc with digest gcc@sha256:11c592a2b05a47f15b2cee8013836e531edcc0de1f75b1827447902f1e948769 ...
Preparing environment 00:00
Running on runner-gwk8tadtq-project-1-concurrent-0 via 7166ed053422...
Getting source from Git repository 02:31
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/root/testproject/.git/
Created fresh repository.
fatal: unable to access 'http://gitlab/root/testproject.git/': Could not resolve host: gitlab
ERROR: Job failed: exit code 1
- Add the CI configuration from
.gitlab-ci.yml
and other configuration if relevant (e.g. docker-compose.yml)
image: gcc
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- mkdir build
- cd build
- cmake ..
- make
artifacts:
paths:
- build/ # Assuming the executable or other build outputs are in this directory
test_job:
stage: test
script:
- echo "Testing the project..."
# Add test commands here
deploy_job:
stage: deploy
script:
- echo "Deploying the project..."
# Add deploy commands here
Can anyone help me to understand what exactly I am missing?