[英]Can the docker image of sonarqube use env for configuring any settings?
I am trying to configure this image with LDAP
. 我正在尝试使用LDAP
配置该映像 。
In the documentation, they argue you can configure for jdbc
with : 在文档中,他们认为您可以使用以下命令配置jdbc
:
SONARQUBE_JDBC_USERNAME
: sonar.jdbc.username
* SONARQUBE_JDBC_USERNAME
: sonar.jdbc.username
* SONARQUBE_JDBC_PASSWORD
: sonar.jdbc.password
* SONARQUBE_JDBC_PASSWORD
: sonar.jdbc.password
* SONARQUBE_JDBC_URL
: sonar.jdbc.url
* SONARQUBE_JDBC_URL
: sonar.jdbc.url
* I wonder how I could do the same for LDAP. 我想知道如何才能对LDAP进行同样的操作。
Is it possible to use any settings through their environment name ? 是否可以通过其环境名称使用任何设置?
Eg: SONAR_LOG_LEVEL=DEBUG
例如: SONAR_LOG_LEVEL=DEBUG
Otherwise, there is inside the container a /opt/sonarqube/conf/sonar.properties
is it there and how should I start editing ? 否则,容器内有一个/opt/sonarqube/conf/sonar.properties
,我应该如何开始编辑?
Otherwise, there is inside the container a /opt/sonarqube/conf/sonar.properties is it there and how should I start editing ? 否则,容器内有一个/opt/sonarqube/conf/sonar.properties,我应该如何开始编辑?
No, generally what you want to do is possible adding information to your docker-compose file. 不,通常您想要做的是可以将信息添加到docker-compose文件中。 In particular in your YML file under the key "enviroment" you can add whatever variable you want. 特别是在YML文件中的“环境”键下,您可以添加所需的任何变量。 Here an example of docker-compose.yml file: 这是docker-compose.yml文件的示例:
version: "3"
services:
registry:
image: registry:2
ports:
- 0.0.0.0:5000:5000
environment:
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
REGISTRY_STORAGE_DELETE_ENABLED: "true"
volumes:
- /data/reg:/var/lib/registry
hostname: "myhost.registry"
Than use the compose file to deploy the stack with your custom enviroment. 比使用compose文件在您的自定义环境中部署堆栈。
The solution I found it's to take the configuration file (sonar.properties), to parameter it and to place it in docker-compose.yml : 我发现的解决方案是获取配置文件(sonar.properties),对其进行参数设置并将其放置在docker-compose.yml中:
services:
sonarqube:
image: sonarqube
ports:
- "9000:9000"
networks:
- sonarnet
environment:
- sonar.jdbc.url=
volumes:
- sonarqube_conf:/opt/sonarqube/conf
- sonarqube_data:/opt/sonarqube/data
- sonarqube_extensions:/opt/sonarqube/extensions
- ./sonar.properties:/opt/sonarqube/conf/sonar.properties
With that, the config file localy is placed in docker. 这样,配置文件的语言环境就放置在了docker中。
I hope it's help you 希望对您有帮助
Another way of achieving what you want is by creating your own sonar.properties file and copying that into the container along with the wrapper.properties. 实现所需目标的另一种方法是创建自己的sonar.properties文件,并将其与wrapper.properties一起复制到容器中。
In the docker-compose.yml 在docker-compose.yml中
volumes:
- ./sonar-properties:/opt/sonarqube/conf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.