Run Sonarqube In Docker
-
Start a Postgres Docker
It needs to set the hostname for the Postgres Docker, so that the Sonarqube docker can connect it via hostname.
-
Start Sonarqube Docker
-
Create volume for Sonarqube
-
Start Sonarqube Docker
It needs to link the postgres docker, so that sonarqube docker can connect it via hostname.
Bashsudo docker run -d --name sonarqube \ --link postgres:postgres \ -p 9000:9000 \ -e SONAR_JDBC_URL=jdbc:postgresql://postgres/sonarqube?currentSchema=public \ -e SONAR_JDBC_USERNAME=<pg user> \ -e SONAR_JDBC_PASSWORD=<pg pass> \ -v sonarqube_data:/opt/sonarqube/data \ -v sonarqube_extensions:/opt/sonarqube/extensions \ -v sonarqube_logs:/opt/sonarqube/logs \ sonarqube:lts
Now, run
docker logs -f sonarqube
to check the sonarqube log.
-
-
Using Nginx as Proxy
Nginx Configuration Fileserver { ... location / { proxy_pass http://127.0.0.1:9000; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto http; } ... }