How to launch runner and gitlab running locally using docker-compose

Hi all,

I have the following docker-compose.yml:

version: '3'
    image: gitlab/gitlab-ce:13.6.5-ce.0
        external_url 'http://gitlab'
        gitlab_rails['initial_root_password'] = "password"
        gitlab_rails['initial_shared_runners_registration_token'] = "token"
      - 8929:80

    image: gitlab/gitlab-runner:alpine
    container_name: gitlab-runner
      - gitlab
    restart: always
  #  command: ["gitlab-runner", "register", "--non-interactive", '--executor "docker"', '--docker-image alpine:latest', '--url "http://gitlab"', '--registration-token "token"', '--description "docker-runner"', '--tag-list "docker,aws"', '--run-untagged="true"', '--locked="false"', '--access-level="not_protected"']
      - /Users/Shared/gitlab-runner/config:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock

Forget about the command on gitlab-runner. I’m running it afterwards, and the runner registers on gitlab.
However the jobs fails with the following error:

fatal: unable to access ‘http://gitlab/root/the-metamorphosis.git/’: Could not resolve host: gitlab

17ERROR: Job failed: exit code 1

But inside the gitlab-runner container I can do: git clone http://gitlab/root/the-metamorphosis.git/ successfully after putting the username and password.

Any ideia of what could be wrong on this setup?

Where are the failing jobs executed? Guest or host?

I don’t know. What do you mean by Guest or host?

Here is the full stack of job:

Running with gitlab-runner 13.8.0 (775dd39d)
  on docker-runner 4LRuAaFx
Preparing the "docker" executor
Using Docker executor with image alpine:latest ...
Pulling docker image alpine:latest ...
Using docker image sha256:28f6e27057430ed2a40dbdd50d2736a3f0a295924016e294938110eeb8439818 for alpine:latest with digest alpine@sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be ...
Preparing environment                                               00:03
Running on runner-4lruaafx-project-2-concurrent-0 via e6af851a0d2a...
Getting source from Git repository                              00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/root/the-metamorphosis/.git/
Created fresh repository.
fatal: unable to access 'http://gitlab/root/the-metamorphosis.git/': Could not resolve host: gitlab
ERROR: Job failed: exit code 1

The runners throws a new container (runner-4lruaafx-project-2-concurrent-0 via e6af851a0d2a) to run the job. It seems that this new container is on a different network.

How can this be avoided?