2017-05-28 89 views
0

我正在将我现有的Jenkins实例从一台服务器迁移到另一台服务器中托管的Docker。顺便说一下,我是新来的Docker。Jenkins在Docker中:无法解析VCS主机

我能够在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) 

应该如何我泊坞窗的配置看,以获得VCS主机来解决?

我现在的码头工人,compose.xml看起来是这样的: -

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

非常感谢你。

回答

1

如果您有一个内部DNS服务器(ES),添加它们是这样的:

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:x.x.x.x"

更换x.x.x.xtfs主机的IP。

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

+0

谢谢。 'dns'和'dns_search'的组合对我来说是个诀窍。 – limc