Set up and start your container
How to set up and start your SonarQube Server container with the Developer or Enterprise edition.
You can set up and start the SonarQube container either from the command line (docker run) or from a configuration file (docker compose). Installation setup relies on system properties, which are preferably configured via environment variables in a Docker environment.
Using docker run
Run the image as illustrated in the docker run command below. You can define your system properties by using the -e environment variable flag in the command. See #Mandatory and relevant settings below for information about the properties to be set.
$> 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>Note that:
By default, the server running within the container will listen on port 9000. The
-p 9000:9000argument is used to expose the container port 9000 to the host port 9000:-p port1:port2maps container’s portport1asport2on the host.For
<image_name>, check the tags currently available on the DockerHub page.
Using Docker compose
If you’re using Docker Compose, use this yml file example as a reference when configuring your .yml file. You can define the system properties by setting the corresponding environment variables in the environment section of the .yml file. See #Mandatory and relevant settings below for information about the properties to be set.
Note that:
By default, the server running within the container will listen on port 9000. The following code is used to expose the container port 9000 to the host port 9000 (
"port1:port2"maps container’s portport1asport2on the host):
ports:
- "9000:9000"In the
imagetag, use the tag value corresponding to the SonarQube Server version you want to use. Check the SonarQube Server image tags currently available on the DockerHub page. For example, to use the LTA version of the Developer Edition:image: sonarqube:2025-lta-developer
Mandatory and relevant settings
You must set the access to your database and you should check the web server connection parameters. This section explains also other settings that are optional.
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:
SONAR_JDBC_USERNAME
SONAR_JDBC_PASSWORD
SONAR_JDBC_URL
For more information, see List of properties common to all editions #General.
Check the web server connection parameters
Check the default values of the following system properties and change their values if necessary:
SONAR_WEB_HOST
SONAR_WEB_PORT
SONAR_WEB_CONTEXT
To do so, see List of properties common to all editions #Web server connection.
Enabling IPv6
When you run your Docker container:
Enable IPv6 in the JVM by setting the
JAVA_TOOL_OPTIONSenvironment variable to-Djava.net.preferIPv6Addresses=true.Enable IPv6 in SonarQube by setting the
SONAR_WEB_JAVAADDITIONALOPTSenvironment variable (system property) to-Djava.net.preferIPv6Addresses=true.
See below for instructions depending on the Docker tool used.
IPv6 is not officially supported for the Docker images of the Data Center Edition.
Keeping user sessions alive on server restart
To maintain your user sessions accross server restarts:
Store the JWT token you generated during pre-installation in the
SONAR_AUTH_JWTBASE64HS256SECRETsystem property.
See also Defining a JWT token.
Related pages
Configuring network security features:
Last updated
Was this helpful?

