简体   繁体   English

在 Jenkins 上配置 SonarQube

[英]Configure SonarQube on Jenkins

I have SonarQube and Jenkins dockerized(They're running on different containers);我有 SonarQube 和 Jenkins dockerized(它们在不同的容器上运行); sonar is running on localhost:9000 and Jenkins is running on localhost:8080. sonar 在 localhost:9000 上运行,Jenkins 在 localhost:8080 上运行。 I configured the Sonar credentials(with acces Token) on Jenkins, but i when run SonarScanner I'm getting the following error by SonarScaner on Jenkins:我在 Jenkins 上配置了 Sonar 凭据(使用访问令牌),但是当我运行 SonarScanner 时,我在 Jenkins 上通过 SonarScaner 收到以下错误:

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)

Docker:码头工人: 在此处输入图片说明

How could i solve this, or make that both containers communicate between each others?我该如何解决这个问题,或者让两个容器相互通信?

You can't use 127.0.0.1 as the IP address because that's the IP of the local container.不能使用127.0.0.1作为 IP 地址,因为这是本地容器的 IP。 You need to use the IP of the host.您需要使用主机的IP。

I wrote an article on how to setup a Docker container of Jenkins and SonarQube to talk to each other that explains the setup.我写了一篇关于如何设置 Jenkins 和 SonarQube 的 Docker 容器以相互交流的文章,解释了设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM