newtmitch / docker-sonar-scanner

Quick sonar scanner docker image
MIT License
129 stars 88 forks source link

Unable to use custom configs, and readme is out of date. #6

Closed acoard closed 6 years ago

acoard commented 6 years ago

The readme file has the following example text:

docker run -ti -v $(pwd):/root/src --link sonarqube mitch/sonarscanner sonar-scanner \
  -Dsonar.host.url=http://sonarqube:9000 \
  -Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar \
  -Dsonar.projectKey=MyProjectKey \
  -Dsonar.projectName="My Project Name" \
  -Dsonar.projectVersion=1 \
  -Dsonar.projectBaseDir=/root \
  -Dsonar.sources=./src

Note that the docker image it loads is mitch/sonarscanner sonar-scanner. Ever other example in the readme uses newtmitch/sonar-scanner. If you try to use the former text you get an error about docker unable to find the image. Presumably this is just out of date and needs updating?

However, even when I update the text I'm still unable to get the configs to load properly.

docker run -ti -v $srcDir:/root/src --link sonarqube newtmitch/sonar-scanner \
  -Dsonar.projectName="example" \
  -Dsonar.projectKey=example \
  -Dsonar.host.url=http://localhost:9000 \  
  -Dsonar.login=123ijfepajfpafeapfjapfjexample

Error message:

docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"-Dsonar.projectName=example\": executable file not found in $PATH".

I thought it might be bash / argument parsing error, but the issue persists regardless if I break the config options into new lines or put them all on one line.

I'm relatively new to docker, so it's possible the error is my fault and unrelated to docker-sonar-scanner. I'm still working on it and will update when I have info.

P.S. - Thanks for working on this docker sonar scanner project, it's exactly what we needed and I really appreciate the time you've put into it. Thanks for keeping open source kickin'. :)

edit: So, upon closer reading of the readme it looks like i) updating the name of the image is addressed in the readme ii) but, the old image is still non-existant.

Lastly, when trying this command from the readme I continue to get the same error:

$ docker run -ti -v $srcDir:/root/src --link sonarqube newtmitch/sonar-scanner -Dsonar.host.url="http://localhost:9000"

docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"sonar.host.url=http://localhost:9000\": stat sonar.host.url=http://localhost:9000: no such file or directory".

The presence of -Dsonar.host.url=http://localhost:9000 is enough to cause the error.

acoard commented 6 years ago

This was completely my fault, I must have gotten the syntax wrong. Apologies! Here's the line that worked for me if anyone's curious.


docker run -ti -v $(pwd):/root/src --link sonarqube newtmitch/sonar-scanner sonar-scanner -Dsonar.projectName="example" -Dsonar.projectKey="example"
newtmitch commented 6 years ago

Thanks for closing the loop on this, Adam. It appears that the final command that worked for you can be derived from the README I have in place, although wasn't an explicit example that I gave, correct?

I see two possible issues with your original commands:

And you do have a couple of good points about the README consistency. I'll get that updated soon to make sure newtmitch/sonar-scanner is changed to newtmitch/sonarscanner where necessary.

Thanks!