一个jenkins的bug
部署在redhat上docker中的jenkins运行了很久了,最新发现一个站点不是最新的,于是去查看发现git仓库都连不上,我换成外网github的仓库就可以连非得是https吗????
提示是域名解析失败,我宿主机上直接执行git命令pull代码没问题,这说明域名解析是没问题的,至少宿主机上是没问题的,那剩下的就是docker容器的问题了
果然stackoverflow上找到解决方案了2中解决方案
- Passing dns settings with
--dns="8.8.8.8"
to the container while usingdocker run
- Configure the DNS of the docker daemon itself this file
/etc/docker/daemon.json
by adding the following:
{ "dns": ["8.8.8.8"] }
参考:
https://stackoverflow.com/questions/55165878/jenkins-job-execution-could-not-resolve-host-github-com