在环境变量中指定的端口而不是 9000 上启动 sonarqube

Start sonarqube on port specified in environment variable instead of 9000

我正在尝试 运行 CloudRun 上的 sonarqube。但是 DockerHub 上的默认镜像在端口 9000 上启动。我如何修改它以使用环境变量指定的端口 PORT?

https://hub.docker.com/_/sonarqube/

您可以在 SonarQube 安装文件夹中的配置文件中更改端口。

该文件位于 conf 文件夹中。

路径:$SONARQUBE-HOME/conf/sonar.properties.

在 sonar.properties 文件中,您可以更改默认 Web 端口。

您指定的 image 中似乎没有 PORT 的 ENV。

所以映射所需主机端口的一种方法例如 8080

docker run  -d --name sonarqube -p 8080:9000 sonarqube

或者如果你想在不同的端口启动它,那么你需要绑定配置文件。

sonar.properties

sonar.web.port=8080

然后

docker run  -d --name sonarqube -v $PWD/conf/:/opt/sonarqube/conf  -p 8080:8080 sonarqube

使用绑定安装的文件夹

The images contain the SonarQube installation at /opt/sonarqube. You need to use bind-mounted folders to override selected files or directories :

/opt/sonarqube/conf:

configuration files, such as sonar.properties

sonar First installation