2017-05-28 35 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