Skip to content

Latest commit

 

History

History
105 lines (55 loc) · 3.92 KB

sonarqube.md

File metadata and controls

105 lines (55 loc) · 3.92 KB

Logo

Docker With SonarQube

In here we will see how to containerize sonarqube in Docker.

Content

  1. Prerequisites
  2. Postgres Installation
  3. SonarQube Installation
  4. DockerCompose File

Prerequisites

Install docker
Install docker compose

Postgres Installation

To create the docker container for the postgres run the following command. Make sure that the given port in the following command is not used already

docker run --name postgres -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -it postgres

To see the created container run the following command,this command shows all the containers

docker ps -a

postgres

SonarQube Installation

To create the docker container for the postgres run the following command. Make sure that the given port in the following command is not used already

docker run --name sonarqube --link postgres -e sonar.jdbc.url=jdbc:postgresql://postgres:5432/sonar -p 9000:9000 -it sonarqube

To see the created container run the following command,this command shows all the containers

docker ps -a

sonar

To run the SonarQube enter the following url in browser

 http://localhost:9000/about

sonarqube

Click on the login

Login

By default,

userName: admin and password: admin

credential

After login if we need to change the password click on Administrator and then click in My Account

account

Then select the security

profile

security

Then change the passwor by give the old password and new password

changePassword

Login witht the changed password

changed

Docker Compose File

This is the another way to containerize the sonarqube with postgres. Download the following file

https://github.com/udhaya-un/SonarQube/blob/master/docs/docker-compose.yml

Make sure that the port given in the file are not in use.

How to up the docker-compose file

open the directory of this file in terminal and run the following command to up the containers

docker-compose up -d

When up the docker compose fiel at that time volume of the container is created, to see the volume execute the following command

docker exec -it [containername] bash 

Now, open the folder Which is mentioned under volumes for postgres there you can able to see the folder *data which is the backup for container.

cd var/lib/postgresql

Do the same for the sonarqube also to see the volumes.

To run the SonarQube enter the following url in browser

 http://localhost:9000/about

sonarqube