在Jenkins上配置SonarQube

时间:2018-04-18 20:42:34

标签: docker jenkins sonarqube jenkins-plugins sonarqube-scan

我有SonarQube和Jenkins对接(他们在不同的容器上运行); sonar在localhost:9000上运行,Jenkins在localhost:8080上运行。我在Jenkins上配置了Sonar凭证(带有访问令牌),但是当我运行SonarScanner时,SonarScaner在Jenkins上收到以下错误:

ERROR: SonarQube server [http://localhost:9000] can not be reached
INFO: ---------------------------------------------------------------- 
INFO: EXECUTION FAILURE
INFO: ---------------------------------------------------------------- 
INFO: Total time: 0.358s
INFO: Final Memory: 4M/119M
INFO: ----------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: Failed to connect to localhost/127.0.0.1:9000
ERROR: Caused by: Connection refused (Connection refused)

泊坞: enter image description here

我怎样才能解决这个问题,或者让两个容器在彼此之间进行通信?

1 个答案:

答案 0 :(得分:0)

您不能使用127.0.0.1作为IP地址,因为那是本地容器的IP。您需要使用主机的IP。

我写了article,介绍了如何设置Jenkins和SonarQube的Docker容器,以便彼此交谈,以解释设置。