Reputation: 1080
I have a raspberry pi with gitlab-runner installed (linux version) and a git repository on gitlab.com (not self hosted).
At the beginning of pipeline, gitlab-runner on raspberry try to fetch the .git repo but I get :
Could not resolve host: gitlab.com
I tried :
This error :
Error response from daemon: network gitlab_default not found (exec.go:57:1s)
I am in the simplest configuration with repo on gitlab.com and a gitlab-runner on raspberry. How can I deal with it ?
Here is the config.toml :
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab runner on raspberryPi"
url = "https://gitlab.com/"
token = "XXXX"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "node:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
Upvotes: 3
Views: 11391
Reputation: 3156
Not being able to resolve the host name can have multiple root-causes:
Routing might be disabled on your system. Check if IP forwarding is enabled (== 1).
cat /proc/sys/net/ipv4/ip_forward
1
If it's disabled, it will return 0
, please enable it by editing a sysctl file. For example edit and add: /etc/sysctl.d/99-sysctl.conf
:
net.ipv4.conf.all.forwarding = 1
net.ipv4.ip_forward = 1
Apply the setting without rebooting: sudo sysctl --system
Important Note: Even if the system is reporting that IP forwarding is currently enabled, you might want to set to explicitly and correctly in your sysctl configs. Since Docker will run sysctl -w net.ipv4.ip_forward=1
when the Daemon starts-up. But that is not a persistent setting, and might cause very random issues!! Like you have.
You can try if setting a DNS server to 8.8.8.8
might fix the problem:
[runners.docker]
dns = ["8.8.8.8"]
You can also try to add an extra host, which might be mainly relevant within a local network (so not with gitlab.com
domain).
[runners.docker]
extra_hosts = ["gitlab.yourdomain.com:192.168.xxx.xxx"]
I really do not advise this, but you could configure the Docker container to run with network_mode
as "host". Again, only do this for debugging reasons:
[runners.docker]
network_mode = "host"
Upvotes: 1
Reputation: 57
I had same issue , my gitlab-runner was running on my local. I restarted my docker
systemctl restart docker
and error went away.
Upvotes: 0