ntscx

How to Install SonarQube Using Docker

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

Step-by-Step Installation

  1. 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.

  1. 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"
  1. 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: