|
|
@@ -16,15 +16,13 @@ WARNING:
|
|
|
|
|
|
# Supported tags and respective `Dockerfile` links
|
|
|
|
|
|
-- [`6.7.5`, `lts` (*6.7.5/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/5d738964cc4b857ca5b399d6f0bb626b6710bac6/6.7.5/Dockerfile)
|
|
|
-- [`6.7.5-alpine`, `lts-alpine` (*6.7.5-alpine/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/5d738964cc4b857ca5b399d6f0bb626b6710bac6/6.7.5-alpine/Dockerfile)
|
|
|
-- [`7.1`, `latest` (*7.1/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/5d738964cc4b857ca5b399d6f0bb626b6710bac6/7.1/Dockerfile)
|
|
|
-- [`7.1-alpine`, `alpine` (*7.1-alpine/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/5d738964cc4b857ca5b399d6f0bb626b6710bac6/7.1-alpine/Dockerfile)
|
|
|
+- [`6.7.6-community`, `6.7-community`, `lts` (*6.7.6-community/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/b3cb018a78ad7879bf1e07e2516f1497eb15a0c2/6.7.6-community/Dockerfile)
|
|
|
+- [`7.4-community`, `latest` (*7.4-community/Dockerfile*)](https://github.com/SonarSource/docker-sonarqube/blob/b3cb018a78ad7879bf1e07e2516f1497eb15a0c2/7.4-community/Dockerfile)
|
|
|
|
|
|
# Quick reference
|
|
|
|
|
|
- **Where to get help**:
|
|
|
- [the Docker Community Forums](https://forums.docker.com/), [the Docker Community Slack](https://blog.docker.com/2016/11/introducing-docker-community-directory-docker-community-slack/), or [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=docker)
|
|
|
+ [the SonarSource Community forum](https://community.sonarsource.com/tags/c/help/sq/docker), [the Docker Community Forums](https://forums.docker.com/), [the Docker Community Slack](https://blog.docker.com/2016/11/introducing-docker-community-directory-docker-community-slack/), or [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=docker)
|
|
|
|
|
|
- **Where to file issues**:
|
|
|
[https://github.com/SonarSource/docker-sonarqube/issues](https://github.com/SonarSource/docker-sonarqube/issues)
|
|
|
@@ -51,70 +49,99 @@ WARNING:
|
|
|
|
|
|
# What is SonarQube?
|
|
|
|
|
|
-SonarQube is an open source platform for continuous inspection of code quality.
|
|
|
-
|
|
|
-> [wikipedia.org/wiki/SonarQube](http://en.wikipedia.org/wiki/SonarQube)
|
|
|
+[SonarQube](https://www.sonarqube.org/) is an open source product for continuous inspection of code quality.
|
|
|
|
|
|

|
|
|
|
|
|
# How to use this image
|
|
|
|
|
|
+This Docker image contains the Community Edition of SonarQube.
|
|
|
+
|
|
|
## Run SonarQube
|
|
|
|
|
|
The server is started this way:
|
|
|
|
|
|
```console
|
|
|
-$ docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
|
|
|
+$ docker run -d --name sonarqube -p 9000:9000 sonarqube
|
|
|
```
|
|
|
|
|
|
-By default you can login as `admin` with password `admin`, see [authentication](https://docs.sonarqube.org/display/SONAR/Authentication).
|
|
|
+By default you can login as `admin` with password `admin`, see [authentication documentation](https://docs.sonarqube.org/latest/instance-administration/security/).
|
|
|
|
|
|
-To analyse a project:
|
|
|
+To analyze a Maven project:
|
|
|
|
|
|
-```console
|
|
|
-$ On Linux:
|
|
|
-mvn sonar:sonar
|
|
|
+ # On Linux:
|
|
|
+ mvn sonar:sonar
|
|
|
+
|
|
|
+ # With boot2docker:
|
|
|
+ mvn sonar:sonar -Dsonar.host.url=http://$(boot2docker ip):9000
|
|
|
|
|
|
-$ With boot2docker:
|
|
|
-mvn sonar:sonar -Dsonar.host.url=http://$(boot2docker ip):9000 -Dsonar.jdbc.url="jdbc:h2:tcp://$(boot2docker ip)/sonar"
|
|
|
-```
|
|
|
+To analyze other kinds of projects and for more details see [Analyzing Source Code documentation](https://redirect.sonarsource.com/doc/analyzing-source-code.html).
|
|
|
+
|
|
|
+## Advanced configuration
|
|
|
|
|
|
-## Database configuration
|
|
|
+### Option 1: Database configuration
|
|
|
|
|
|
By default, the image will use an embedded H2 database that is not suited for production.
|
|
|
|
|
|
-The production database is configured with these variables: `SONARQUBE_JDBC_USERNAME`, `SONARQUBE_JDBC_PASSWORD` and `SONARQUBE_JDBC_URL`.
|
|
|
+The production database is configured with the following SonarQube properties used as environment variables: `sonar.jdbc.username`, `sonar.jdbc.password` and `sonar.jdbc.url`.
|
|
|
|
|
|
```console
|
|
|
$ docker run -d --name sonarqube \
|
|
|
- -p 9000:9000 -p 9092:9092 \
|
|
|
- -e SONARQUBE_JDBC_USERNAME=sonar \
|
|
|
- -e SONARQUBE_JDBC_PASSWORD=sonar \
|
|
|
- -e SONARQUBE_JDBC_URL=jdbc:postgresql://localhost/sonar \
|
|
|
- sonarqube
|
|
|
+ -p 9000:9000 \
|
|
|
+ -e sonar.jdbc.username=sonar \
|
|
|
+ -e sonar.jdbc.password=sonar \
|
|
|
+ -e sonar.jdbc.url=jdbc:postgresql://localhost/sonar \
|
|
|
+ sonarqube
|
|
|
```
|
|
|
|
|
|
+Use of the environment variables `SONARQUBE_JDBC_USERNAME`, `SONARQUBE_JDBC_PASSWORD` and `SONARQUBE_JDBC_URL` is deprecated, and will stop working in future releases.
|
|
|
+
|
|
|
More recipes can be found [here](https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md).
|
|
|
|
|
|
-## Administration
|
|
|
+### Option 2: Use parameters via Docker environment variables
|
|
|
+
|
|
|
+You can pass `sonar.` configuration properties as Docker environment variables, as demonstrated in the example above for database configuration.
|
|
|
+
|
|
|
+### Option 3: Use bind-mounted persistent volumes
|
|
|
|
|
|
-The administration guide can be found [here](http://docs.sonarqube.org/display/SONAR/Administration+Guide).
|
|
|
+The images contain the SonarQube installation at `/opt/sonarqube`. You can use bind-mounted persistent volumes to override selected files or directories, for example:
|
|
|
|
|
|
-# Image Variants
|
|
|
+- `sonarqube_conf:/opt/sonarqube/conf`: configuration files, such as `sonar.properties`
|
|
|
+- `sonarqube_data:/opt/sonarqube/data`: data files, such as the embedded H2 database and Elasticsearch indexes
|
|
|
+- `sonarqube_logs:/opt/sonarqube/logs`
|
|
|
+- `sonarqube_extensions:/opt/sonarqube/extensions`: plugins, such as language analyzers
|
|
|
|
|
|
-The `sonarqube` images come in many flavors, each designed for a specific use case.
|
|
|
+You could also use bind-mounted configurations specified on the command line, for example:
|
|
|
|
|
|
-## `sonarqube:<version>`
|
|
|
+```console
|
|
|
+$ docker run -d --name sonarqube \
|
|
|
+ -p 9000:9000 \
|
|
|
+ -v /path/to/conf:/opt/sonarqube/conf \
|
|
|
+ -v /path/to/data:/opt/sonarqube/data \
|
|
|
+ -v /path/to/logs:/opt/sonarqube/logs \
|
|
|
+ -v /path/to/extensions:/opt/sonarqube/extensions \
|
|
|
+ sonarqube
|
|
|
+```
|
|
|
|
|
|
-This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
|
|
|
+### Option 4: Customized image
|
|
|
|
|
|
-## `sonarqube:<version>-alpine`
|
|
|
+In some environments, it may make more sense to prepare a custom image containing your configuration. A `Dockerfile` to achieve this may be as simple as:
|
|
|
+
|
|
|
+```dockerfile
|
|
|
+FROM sonarqube:7.4-community
|
|
|
+COPY sonar.properties /opt/sonarqube/conf/
|
|
|
+```
|
|
|
|
|
|
-This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
|
|
|
+You could then build and try the image with something like:
|
|
|
|
|
|
-This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
|
|
|
+```console
|
|
|
+$ docker build --tag=sonarqube-custom .
|
|
|
+$ docker run -ti sonarqube-custom
|
|
|
+```
|
|
|
+
|
|
|
+## Administration
|
|
|
|
|
|
-To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar).
|
|
|
+The administration guide can be found [here](https://redirect.sonarsource.com/doc/administration-guide.html).
|
|
|
|
|
|
# License
|
|
|
|