I build my app from Jenkins inside a Docker container using a series of commands like docker exec mycontainer /bin/bash -c 'mvn clean install'
. I'm also used to the SonarQube plugin to configure the server URL and the authentication token, i.e.
...
withSonarQubeEnv('MySonarQubeServer') {
script {
sh "docker exec mycontainer /bin/bash -c 'mvn sonar:sonar'"
}
}
...
I'm getting
SonarQube server [http://localhost:9000] can not be reached
obviously because the server is not configured inside the container. My question is how Jenkins configures it. At https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/ I found how to set the server URL in the pom.xml and the authentication token on the command line. Is there another way to forward URL and token, for example via environment variables?