Jenkins在Docker中:无法parsingVCS主机

我正在将我现有的Jenkins实例从一台服务器迁移到托pipe在另一台服务器上的Docker。 顺便说一下,我是新来的Docker。

我能够毫无困难地在Docker中运行Jenkins实例。 但是,当我运行作业时,无法连接到VCS回购:

stderr: fatal: unable to access 'http://tfs/path/to/app/': Could not resolve host: tfs at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:807) 

我的Dockerconfiguration应该如何查看才能让VCS主机解决?

我目前的docker-compose.xml如下所示:

 version: '2' services: jenkins: image: "jenkinsci/jenkins" ports: - "80:8080" volumes: - ./jenkins:/var/jenkins_home environment: JAVA_OPTS: "-Xms2048m -Xmx4096m" 

非常感谢你。

如果你有一个内部的DNS服务器,像这样添加它们:

dns: 1.2.3.4

要么

dns: - 1.2.3.4 - 4.3.2.1

更多信息: https : //docs.docker.com/compose/compose-file/compose-file-v2/#dns

或者你可以使用这样的extra_hosts

extra_hosts: - "tfs:xxxx"

xxxxreplace为tfs主机的IP地址。

更多信息: https : //docs.docker.com/compose/compose-file/compose-file-v2/#extra_hosts