Docker-sonarqube: Ability to set the sonar web context by environment

Created on 18 Jan 2016  路  10Comments  路  Source: SonarSource/docker-sonarqube

Hi,

I need to change the default web context of sonar to /sonar. Is it possible to set this value through an docker environment variable ?

Thanks,

Romain Schlick

Most helpful comment

I have proposed a pull request, but I don't have access on your repository.
I have clone your repository and push the commit on my repository here:
https://github.com/rschlick/docker-sonar

In Dockerfile I have added:

ENV SONARQUBE_WEB_CONTEXT /

And in run.sh (in the exec java commands):

-Dsonar.web.context="$SONARQUBE_WEB_CONTEXT" \

All 10 comments

I have proposed a pull request, but I don't have access on your repository.
I have clone your repository and push the commit on my repository here:
https://github.com/rschlick/docker-sonar

In Dockerfile I have added:

ENV SONARQUBE_WEB_CONTEXT /

And in run.sh (in the exec java commands):

-Dsonar.web.context="$SONARQUBE_WEB_CONTEXT" \

sonar.web.context has been removed in SonarQube version 5.4 - see https://jira.sonarsource.com/browse/SONAR-7122

I vote for reopening this, as the web context will be added in sonar 5.5 again!

https://jira.sonarsource.com/browse/SONAR-7494

@tobilarscheid could you please check #22 - in comparison with this request it introduces more generic variable which can be used to specify various options via sonar.web.javaAdditionalOpts and not just context, and in comparison with #20 it allows to pass it without removal of current default value -Djava.security.egd=file:/dev/./urandom. This looks to me as cleanest solution, if it covers this need, then no pb to merge it.

Yes, I think #22 is a clean solution!

Closed in preference to #22

In fact SONARQUBE_WEB_JVM_OPTS (#22) doesn't work for sonar.web.*, however without any modifications, i.e. even for older images (e.g. 5.3), you can do

docker run -p 9000:9000 -it sonarqube:5.3 -Dsonar.web.context=/sq

arguments specified for docker run are passed to jvm. Thus, is there any benefits in addition of environment variable to specify the same?

Hi!
I am trying to change 'sonar.web.context' property within Dockerfile (as ENV property) or docker-compose.yml (as environment property):

ENV sonar.web.context /sonarqube
or
ENV JAVA_OPTS -Dsonar.web.context=/sonarqube

Is there a way to make it work?
Or do I do something wrong?

@IrishkA13 there is no such variables sonar.web.context and JAVA_OPTS, so that why it doesn't work. As explained in https://github.com/SonarSource/docker-sonarqube/issues/17#issuecomment-216856248 just above your comment, you can do:

docker run -p 9000:9000 -it sonarqube -Dsonar.web.context=/sonarqube

and equivalent of this in a docker-compose notation:

version: "2"

services:
  sonarqube:
    image: sonarqube
    command: -Dsonar.web.context=/sonarqube
    ports:
      - "9000:9000"

@Godin thanks a lot for reply!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carloscds picture carloscds  路  3Comments

alexsuter picture alexsuter  路  3Comments

adrianblakey picture adrianblakey  路  5Comments

longquan7 picture longquan7  路  7Comments

valeriimars picture valeriimars  路  8Comments