Add Dock Host Redirection

I am using gitlab in a virtual machine. And I will use gitlab-ci (in the same VM), with docker.

To access my gitlab, I use the git.local domain (redirect to my virtual machine on my computer, redirect to 127.0.0.1 on my virtual machine).

And when I run the tests, the test answer is:

fatal: cannot access http: // gitlab-ci-token: xxxxxx@git.local /thib3113/ESCF.git/ ': Unable to resolve host' git.local '

So my question is: how do I add a redirect for git.local to the container IP? I see arg -h <host>for dockers, but I don't know how to tell gitlab to use this argument. Or maybe the configuration for using docker to use the dns container?

I see the following: How do I get a Docker Gitlab CI runner to access Git on my parent host? but the same problem, I do not know how to add an argument: /.

+4
source share
1 answer

According to the GitLab CI Runner Advanced configuration, you can try playing with a parameter extra_hostsin your GitLab CI runner. In /etc/gitlab-runner/config.toml:

[[runners]]
  url = "http://localhost/ci"
  token = "TOKEN"
  name = "my_runner"
  executor = "docker"
  [runners.docker]
    host = "tcp://<DOCKER_DAEMON_IP>:2375"
    image = "..."
    ...
    extra_hosts = ["localhost:192.168.0.39"]

, , git, localhost, 192.168.0.39 IP .

+10

Source: https://habr.com/ru/post/1619636/


All Articles