newtmitch / docker-sonar-scanner

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

Change default Host to localhost #2

Closed madnight closed 7 years ago

madnight commented 7 years ago

Most users will run their docker containers on linux and therefore expect the IP to be 127.0.0.1 by default, if all containers are started on the same host.

sonar.host.url=http://192.168.99.100:9000 should be sonar.host.url=http://127.0.0.1:9000

newtmitch commented 7 years ago

Thanks. Good note.

Can't say I'm sure that most users will run Docker inside Linux, or that it's worth making a decision for any one platform or another. That said, I think the real question is whether "localhost" is the better answer overall.

Since this was originally built Docker changed the way Docker Machine works on Mac and allows it to be interacted with via localhost vs the local IP of the Docker VM (like it used to - hence the weird 192.168.** address). Let me fire this up and see if a change to localhost would work for Mac as well.

newtmitch commented 7 years ago

So I made a few changes to the README and changed from hardcoded addresses to Docker named links, which although deprecated, are a faster way (right now) to get this up and running without introducing the entire Docker Network feature.

I've checked this in to the develop branch before I merge into master. Take a look and see if that works better for you. For me to test in Linux I'll need to do a Docker-inside-Docker thing, and I don't have the time to dig into that right away... :)

newtmitch commented 7 years ago

I'm going to go ahead and merge this into the master branch for now and close the issue. If it pops up again, feel free to comment. Thanks for the report.

madnight commented 7 years ago

Yes i think the link solution is fine docker run -ti -v $(pwd):/root/src --link sonarqube mitch/sonarscanner. How about upgrading to https://github.com/newtmitch/docker-sonar-scanner/blob/master/Dockerfile#L2 Java 8?

newtmitch commented 7 years ago

I actually tried that as part of this effort as I needed to stand the system up again and I discovered another problem that I fixed in the readme in commit 90110133a30ccc9bbba3da334b05a6c54af14957 - basically I hadn't been specifying a specific version of Sonar Qube that matched the client. They've both revved since then and my command for starting the server per the README was out of date. So updating to Java 8 might work, but it likely requires a bit more digging. You're welcome to submit a PR though, and I'll check it out!