在Jenkins上配置SonarQube [英] Configure SonarQube on Jenkins

查看:413
本文介绍了在Jenkins上配置SonarQube的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有SonarQube和Jenkins dockerized(它们在不同的容器上运行);声纳运行在localhost:9000上,詹金斯运行在localhost:8080上.我在Jenkins上配置了Sonar凭证(带有acces令牌),但是在运行SonarScanner时,我在Jenkins上收到了SonarScaner的以下错误:

I have SonarQube and Jenkins dockerized(They're running on different containers); sonar is running on localhost:9000 and Jenkins is running on 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:

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?

推荐答案

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

You can't use 127.0.0.1 as the IP address because that's the IP of the local container. You need to use the IP of the host.

我写了文章关于如何设置Jenkins和SonarQube的Docker容器,互相交谈以解释设置.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆