Running a local Sonarqube with Docker

|

In order to get the Maven configuration of Sonar right, I wanted to have a local Sonarqube to test with. Using Docker, this is totally trivial.

Run the Docker container

You should already have Docker running on your local machine. Download the Sonarqube container from Docker Hub like this

docker pull sonarqube

After downloading, start the container via

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube:5.1

You should see a Sonarqube installation at

http://localhost:9000

Run Maven goal

I assume that your project is already configured with the Maven Sonar plugin. Now simply run the goal with the local Sonarqube installation

mvn sonar:sonar -Dsonar.host.url=http://localhost:9000

You should see the generated metrics at

http://localhost:9000
blog comments powered by Disqus