Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update readme to indicate the port binding #2486

Merged
merged 10 commits into from
Aug 30, 2024
20 changes: 15 additions & 5 deletions sonarqube/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ To run a cluster with the Data Center Edition, please refer to Installing SonarQ

## Configuration

### 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 container run`, like the command below:
felipementel marked this conversation as resolved.
Show resolved Hide resolved

```console
docker container run --name sonarqube-custom -p 9000:9000 sonarqube:10.6-community
felipementel marked this conversation as resolved.
Show resolved Hide resolved
```

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

### Database

By default, the image will use an embedded H2 database that is not suited for production.
Expand All @@ -49,9 +59,9 @@ Set up a database by following the "Installing the Database" section of https://

We recommend creating volumes for the following directories:

- `/opt/sonarqube/data`: data files, such as the embedded H2 database and Elasticsearch indexes
- `/opt/sonarqube/logs`: contains SonarQube logs about access, web process, CE process, Elasticsearch logs
- `/opt/sonarqube/extensions`: for 3rd party plugins
- `/opt/sonarqube/data`: data files, such as the embedded H2 database and Elasticsearch indexes
- `/opt/sonarqube/logs`: contains SonarQube logs about access, web process, CE process, Elasticsearch logs
- `/opt/sonarqube/extensions`: for 3rd party plugins
felipementel marked this conversation as resolved.
Show resolved Hide resolved

> **Warning:** You cannot use the same volumes on multiple instances of SonarQube.

Expand All @@ -66,15 +76,15 @@ For upgrade instructions, see Upgrading from the Docker Image on the [Upgrade th
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:8.9-community
FROM sonarqube:10.6-community
felipementel marked this conversation as resolved.
Show resolved Hide resolved
COPY sonar-custom-plugin-1.0.jar /opt/sonarqube/extensions/
```

You could then build and try the image with something like:

```console
$ docker build --tag=sonarqube-custom .
$ docker run -ti sonarqube-custom
$ docker container run -ti sonarqube-custom
felipementel marked this conversation as resolved.
Show resolved Hide resolved
```

### Avoid hard termination of SonarQube
Expand Down
Loading