Introduction
SonarQube is an open-source platform for continuous inspection of code quality. It provides detailed reports on bugs, code smells, and security vulnerabilities in your codebase. In this guide, we’ll show you how to install SonarQube, Docker-powered.
Prerequisites
- In order to install SonarQube, Docker must be installed on your system, here’s the official documentation how to install Docker
- Basic understanding of Docker commands, a quick overview of Docker commands by Learn X in Y Minutes
Step-by-Step Installation
- Run SonarQube Docker Container Use the following command to start a SonarQube container on your local machine:
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest
This command will download the latest SonarQube Docker image and run it as a daemon.
- Set Up Environment Variable Add SonarQube to your system’s PATH for easy access to the SonarQube scanner:
export PATH="/home/user/Downloads/sonarqube:$PATH"
- Run SonarQube Scanner Execute the SonarQube scanner to analyze your project:
sonar-scanner \
-Dsonar.projectKey=project_name \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=7sdf8asd7g9h0asda77g0asdagh6asdasd0asdu
Replace project_name
with your actual project key and ensure the sonar.login
value is your generated authentication token.
Conclusion
Read more: