Install SonarQube using Docker

I have introduced you all Install SonarQube on Ubuntu. There is a much simpler way to do this than with the Docker. How is it in details? Let’s find out in this tutorial.

First, you guys open the Terminal on MacOS and Linux or Console on Windows, then use the “docker pull” command to download the SonarQube Image from the Docker Repository.

Here, we have two versions of SonarQube:

  • One is the LTS version (Long-term Support): this version is stable.
  • Second is the Latest version: contains the latest features of SonarQube.

To download the LTS version, use the following command:

For the latest version, use the following command:

In this tutorial, I will use the latest version.

Result:

Once you have downloaded SonarQube Image, you will now start a container from this image.

The command to start the container is as follows:

Here, I have mapped port 9000 of the container with port 9000 on my machine and run the container in detach mode so that the container is still running when we shut down the command line.

After running the above command, check all the containers in your machine, you will see the results as follows:

Now, if you access the link http://localhost:9000/, you will see the login page to SonarQube as follows:

By default, you can log in to SonarQube with the username admin and the password as admin too! But after logging in with this username and password, SonarQube will ask you to change the admin user’s password:

Please enter Old Password as “admin”, and New Password with Confirm Password is your new password!

The results after you press the Update button is as follows:

At this point, you can start creating a new project to scan the code!

One thing to keep in mind is that the version of SonarQube installed from the Docker Image uses the H2 Database. If you need to expand or upgrade to a new version of Sonar in the future, do not use this method.

5/5 - (1 vote)

3 thoughts on “Install SonarQube using Docker

  1. Hi there, have you had issues starting sonarQube? Because I cannot start it. Here is my error message:
    2020.03.31 18:29:23 WARN web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [SQ starter] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@11.0.6/java.lang.ClassLoader.defineClass1(Native Method)

    java.base@11.0.6/java.lang.Thread.run(Unknown Source)
    2020.03.31 18:29:23 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped
    2020.03.31 18:29:23 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

Add Comment