Start Free
Latest | Server installation and setup | Developer and Enterprise Editions | Installing from Docker image

Installing SonarQube Server's Developer or Enterprise Edition from the Docker image

On this page

SonarQube Server docker images support running both on the amd64 architecture and on arm64-based Apple Silicon.

We recommend using Docker Engine version 20.10 and above.

First, check theĀ requirements and perform the pre-installation steps. Then follow these steps for your first installation:

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 indexes
    • sonarqube_logs: contains SonarQube Server logs about access, web process, CE process, and Elasticsearch
    • sonarqube_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

Set access to the database

Set the system properties (environment varialbes) related to database access.

Add the JDBC driver (if using an Oracle database)

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:

Ā a. 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.Ā 

b. Exit once SonarQube Server has started properly.

c. Copy the Oracle JDBC driver intoĀ sonarqube_extensions/jdbc-driver/oracle.

Change the web server connection parameters

Check the default values of the web server connection parameters. Change the respective environment variables if necessary.

Start the SonarQube Server container

Start the SonarQube Server container:

  • either from the command line (docker run) orĀ 
  • from a configuration file (docker compose).Ā 

For docker-based setups, environment variables supersede all parameters that were provided with properties. SeeĀ Docker environment variables for more details.

There is more information about installing and updating SonarQube Server plugins inside your Docker volume found on the Install a plugin page.

Port binding

By default, the server running within the container will listen on port 9000. You can expose the container port 9000 to the host port 9000 with theĀ -p 9000:9000Ā argument toĀ docker run, like the command below:

docker run --name sonarqube-custom -p 9000:9000 sonarqube:2025.1.1-developer

You can then browse toĀ http://localhost:9000Ā orĀ http://host-ip:9000Ā in your web browser to access the SonarQube Server web interface.

Enabling IPv6

To enable IPv6 on the Developer or Enterprise Edition, see below. IPv6 is not officially supported for the Docker images of the Data Center Edition.

When you run your Docker container:

  1. Enable IPv6 in the JVM by setting the JAVA_TOOL_OPTIONS environment variable to -Djava.net.preferIPv6Addresses=true.
  2. Enable IPv6 in SonarQube Server by setting the SONAR_WEB_JAVAADDITIONALOPTS environment variable to -Djava.net.preferIPv6Addresses=true.Ā 

See below for instructions depending on the Docker tool used.

With docker-run

Set the environment variables in the docker run command as illustrated below.

docker run -d --name sonarqube \
    -p 9000:9000 \
    -e JAVA_TOOL_OPTIONS="-Djava.net.preferIPv6Addresses=true" \
    -e SONAR_WEB_JAVAADDITIONALOPTS="-Djava.net.preferIPv6Addresses=true" \
    ...  \
    <image_name>

For image_name, check the tags currently available on theĀ DockerHub page.Ā 

With docker-compose

Set the environment variables in the environment section of the .yml file as illustrated below.

...
environment:
      SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
      SONAR_JDBC_USERNAME: sonar
      SONAR_JDBC_PASSWORD: sonar
      JAVA_TOOL_OPTIONS: ā€˜-Djava.net.preferIPv6Addresses=true’
      SONAR_WEB_JAVAADDITIONALOPTS: ā€˜-Djava.net.preferIPv6Addresses=true’

...

Starting the container by using docker run

Run the image with your database properties defined using the -e environment variable flag:

$> docker run -d --name sonarqube \
    -p 9000:9000 \
    -e SONAR_JDBC_URL=... \
    -e SONAR_JDBC_USERNAME=... \
    -e SONAR_JDBC_PASSWORD=... \
    -v sonarqube_data:/opt/sonarqube/data \
    -v sonarqube_extensions:/opt/sonarqube/extensions \
    -v sonarqube_logs:/opt/sonarqube/logs \
    <image_name>

For <image_name>, check the tags currently available on the DockerHub page.Ā 

Starting the container by using Docker compose

If you're usingĀ Docker Compose, use this yml file example as a reference when configuring yourĀ .ymlĀ file. In the image tag, use the tag value corresponding to the SonarQube Server version you want to use, e.g, to use the LTA version of the Developer Edition:

image: Ā sonarqube:2025-lta-developer

Check the SonarQube Server image tags currently available on the DockerHub page.Ā 

Next steps

Once your server is installed and running, you can access SonarQube Server UI in your web browser (the default system administrator credentials areĀ admin/admin) and you're ready to beginĀ analyzing source code.


Was this page helpful?

Ā© 2008-2025 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License