Skip to content

adrianmusante/docker-sonarqube

Repository files navigation

docker-sonarqube

A distribution of Sonarqube Community Edition packaged by Bitnami with addons.

Documentation:

Pre-installed plugins:

Additional features:

  • SonarQube telemetry disabled
  • Unattended migration
  • Health-Check command-line tool
  • Gravatar enabled by default
  • Refresh configuration from environment variables on startup. (Note: The admin user only is loaded in first startup)

Docker registry

The recommended way to get the SonarQube Docker Image is to pull the prebuilt image from the Docker Hub Registry.

To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.

Configuration

Environment variables

When you start the SonarQube image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. If you want to add a new environment variable:

  • For docker-compose add the variable name and value under the application section in the docker-compose.yml file present in this repository:

    sonarqube:
      ...
      environment:
        - USER_DEFINED_KEY=custom_value
      ...
  • For manual execution add a --env option with each variable and value:

    $ docker run -d --name sonarqube -p 80:9000 \
      --env USER_DEFINED_KEY=custom_value \
      --network sonarqube_network \
      --volume /path/to/sonarqube-persistence:/bitnami/sonarqube \
      adrianmusante/sonarqube:latest

Available environment variables:

This SonarQube image inherits all environment variables from Bitnami SonarQube. The differences are:

General configuration
  • SONARQUBE_SKIP_MIGRATION: Performs migration when the version of SonarQube is updated. Otherwise, if the migration is skipped the system will not be operational without performing a manual step. Default: no
  • SONARQUBE_EXTRA_SETTINGS: Comma separated list of settings to be set in Administration -> Configuration -> General Settings, e.g. sonar.lf.enableGravatar=false,sonar.lf.logoUrl=https://mysonar.com/logo. No defaults.
  • SONARQUBE_WEB_URL: HTTP(S) URL of the SonarQube server, such as https://yourhost.yourdomain/sonar. This value is used i.e. to create links in emails or Pull-Request decoration. No defaults.
Email configuration
  • SONARQUBE_EMAIL_FROM_ADDRESS: Emails will come from this address, e.g. [email protected]. If the variable is empty then SONARQUBE_EMAIL variable is used. No defaults.
  • SONARQUBE_EMAIL_FROM_NAME: Emails will come from this address name, e.g. SonarQube. No defaults.
sonarqube-community-branch-plugin
  • SONARQUBE_PR_PLUGIN_RESOURCES_URL: Base URL used to load the images for the PR comments. If the variable is defined as empty the image links are referenced to sonar.core.serverBaseURL. Default: https://raw.githubusercontent.com/mc1arke/sonarqube-community-branch-plugin/master/src/main/resources/static