Skip to content

Instantly share code, notes, and snippets.

@gh0st
Created February 4, 2021 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gh0st/d15083a93eeb8af47a37084ae417b3d7 to your computer and use it in GitHub Desktop.
Save gh0st/d15083a93eeb8af47a37084ae417b3d7 to your computer and use it in GitHub Desktop.
A write up on how to quickly spin up an instance of sonarqube on with a docker container.

SonarQube and Docker

This is a write up on how to get a SonarQube up and running in docker so that the sconar scanner can be run against project source code for source code analysis.

Start SonarQube

first run docker run -d --name sonarqube -p 9000:9000 sonarqube to start the sonarqube container this only needs to be run once because then the container will continue to be there the next time you want the container it just needs to be started

Start Sonar Scanner

Then to run the scan start

docker run --network=host --rm -e SONAR_HOST_URL="http://localhost:9000" -v "C:\Users\hollmanc\Desktop\ava\ava:/usr/src" sonarsource/sonar-scanner-cli -Dsonar.projectKey="ava"

This container is ephemeral so it needs to be run each time the repo needs to be scanned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment