Run Sonarqube Docker Container With Mysql Container

Run SonarQube Docker container with mysql container:

Sonarqube is a tool that can help us automate code inspection. SonarQube by default has h2 database , but it is not compatible with production. so now in the following steps i will install or run sonarqube docker container with mysql container.

start mysql container:

run below command to start mysql container

docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root --name mysql mysql:5.6.43

create database for sonarqube

run the below commands to create db and user for sonarqube

docker exec -it mysql bash 
mysql -uroot -proot
CREATE DATABASE sonarqube_db;
CREATE USER 'sonarqube_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON sonarqube_db.* TO 'sonarqube_user'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

launch sonarqube docker container

docker run -d --name SonarQube --restart=unless-stopped --link mysql:mysql -p 8569:9000 -p 9092:9092 \
-e SONARQUBE_JDBC_USERNAME=sonarqube_user \
-e SONARQUBE_JDBC_PASSWORD=password \
-e "SONARQUBE_JDBC_URL=jdbc:mysql://mysql:3306/sonarqube_db?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" \
sonarqube

run above commannnd to launch sonarqube docker container

sonarqube will start on localhost:9000

by default sonarqube username and password is admin and admin.

NOTE: to launch sonarqube docker container you need minimum 2gb ram. 

 

 

  • launch sonarqube containner with mysql container
  • sonarqube with mysql container
  • sonarqube docker container
  • install sonarqube docker container with mysql database
  • run sonarqube docker
  • sonarqube docker image
  • sonarqube docker setup
  • sonarqube docker tutorial
  • sonarqube docker installation
  • sonarqube docker mysql

Leave a Reply

Your email address will not be published. Required fields are marked *