Docker installation with basic setup
This page explains how to install SonarQube Community Build from the Docker image and perform the basic setup.
Prerequisites
You have:
- Performed the pre-installation checks:
- Installed your database (except if you want to install SonarQube for test purposes and want to use the embedded database H2). See Installing the database.
Create volumes to persist data
Creating the following volumes helps prevent the loss of information when updating to a new version or upgrading to a higher edition:
sonarqube_data
: contains data files, such as Elasticsearch indexessonarqube_logs
: contains SonarQube Server logs about access, web process, CE process, and Elasticsearchsonarqube_extensions
: will contain any plugins you install and the Oracle JDBC driver if necessary.
Create the volumes with the following commands:
$> docker volume create --name sonarqube_data
$> docker volume create --name sonarqube_logs
$> docker volume create --name sonarqube_extensions
Make sure you're using volumes as shown with the above commands, and not bind mounts. Using bind mounts prevents plugins from populating correctly.
Set access to the database
You must configure the access to your database (except if you want to use SonarQube for test purposes and want to use the embedded database H2):. To do so, set the system properties (environment variables) related to database access: see Database > General in the list of system properties.
Oracle database: add the JDBC driver
Drivers for supported databases (except Oracle) are already provided. If you're using an Oracle database, you need to add the JDBC driver to the sonar_extensions
volume. To do this:
1. Start the SonarQube Server container with the embedded H2 database:
$ docker run --rm \
-p 9000:9000 \
-v sonarqube_extensions:/opt/sonarqube/extensions \
<image_name>
For <image_name>
, check the tags currently available on the DockerHub page.
2. Exit once SonarQube Server has started properly.
3. Copy the Oracle JDBC driver into sonarqube_extensions/jdbc-driver/oracle
.
Check the web server connection parameters
Check the default values in Web server > Web server connection in the list of system properties. Change the respective environment variables if necessary.
Related pages
- Docker installation overview
- Docker installation advanced setup
- Configuring network security features:
- Starting SonarQube container
Was this page helpful?