SonarQube Community Build | Server installation and setup | From Docker image | Starting SonarQube container
Starting SonarQube Community Build Docker container
On this page
Start the SonarQube Community Build container:
- either from the command line (docker run) or
- from a configuration file (docker compose).
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>
Note that:
- By default, the server running within the container will listen on port 9000. The
-p 9000:9000
argument is used to expose the container port 9000 to the host port 9000:-p port1:port2
maps container’s portport1
asport2
on the host. - 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.
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 portport1
asport2
on the host):
ports:
- "9000:9000"
- In the
image
tag, use the tag value corresponding to the SonarQube Community Build version you want to use. Check the SonarQube Community Build image tags currently available on the DockerHub page. For example:
image: sonarqube:25.6.0.109173-community
Unless you intend to delete the database and start new when running your image, be careful not to use -v
to docker-compose down
and, be careful when running commands like docker system prune
or docker volume prune
; regardless if you use an external: true
parameter, your database volumes will not persist beyond the initial startup and shutdown of SonarQube.
Related pages
- Docker installation overview
- Docker installation with basic setup
- Docker installation advanced setup
- Configuring network security features:
Was this page helpful?