← すべてのガイド
SonarQube
SonarQube (now split into the free SonarQube Community Build and commercial SonarQube Server) is a static analysis platform that continuously inspects code quality, bugs, vulnerabilities, and code smells across dozens of languages.
このガイドは上記リンク先にあるSonarQube公式ドキュメントをもとに作成されています。ディストリビューションやプロジェクトのバージョンは時間とともに変わるため、本番サーバーでこれらのコマンドを実行する前に、必ず公式ドキュメントで正確なパッケージ名・バージョン名を確認してください。
1Tune the host for embedded Elasticsearch
SonarQube bundles Elasticsearch, which needs raised memory-map and file-descriptor limits on the Docker host itself.
sudo sysctl -w vm.max_map_count=524288sudo sysctl -w fs.file-max=131072ulimit -n 131072ulimit -u 81922Run the container (evaluation)
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:communityThis uses the ephemeral built-in H2-less embedded database and is fine for evaluation only.
3Run with persistent volumes (recommended)
docker run -d --name sonarqube -p 9000:9000 -v sonarqube_data:/opt/sonarqube/data -v sonarqube_extensions:/opt/sonarqube/extensions -v sonarqube_logs:/opt/sonarqube/logs sonarqube:communityFor real usage, also point SONAR_JDBC_URL / SONAR_JDBC_USERNAME / SONAR_JDBC_PASSWORD at an external PostgreSQL database rather than the embedded one.
4First login
Browse to http://localhost:9000 once the container reports it's up.
Default credentials are admin/admin; you'll be forced to change the password on first login.