Dockerfile source for SonarQube docker image.
This source repo was originally copied from: https://github.com/SonarSource/docker-sonarqube
This is not an official Google product.
This image contains an installation Redis.
For more information, see the Official Image Marketplace Page.
Configure gcloud as a Docker credential helper:
gcloud auth configure-docker
gcloud docker -- pull marketplace.gcr.io/google/sonarqube8
Use the following content for the docker-compose.yml
file, then run docker-compose up
.
version: "2"
services:
sonarqube:
container_name: some-sonarqube
image: marketplace.gcr.io/google/sonarqube8
ports:
- 127.0.0.1:9000:9000
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
Or you can use docker run directly:
docker run -it --rm\
--name some-sonarqube \
-p 127.0.0.1:9000:9000 \
-d \
marketplace.gcr.io/google/sonarqube8
Default Administrator credentials are usernameadmin
password admin
Use the following content for the docker-compose.yml
file, then run docker-compose up
.
version: "2"
services:
sonarqube:
container_name: some-sonarqube
image: marketplace.gcr.io/google/sonarqube8
ports:
- 127.0.0.1:9000:9000
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
volumes:
- ./sonarqube_conf:/opt/sonarqube/conf
- ./sonarqube_data:/opt/sonarqube/data
- ./sonarqube_extensions:/opt/sonarqube/extensions
- ./sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_bundled-plugins:
Or you can use docker run
directly:
docker run -it --rm\
--name some-sonarqube \
-p 127.0.0.1:9000:9000 \
-d \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_data:/opt/sonarqube/data \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins \
marketplace.gcr.io/google/sonarqube8
Default Administrator credentials are usernameadmin
password admin
Run command sysctl -w vm.max_map_count=262144
to encrease virual memory
version: "2"
services:
sonarqube:
container_name: some-sonarqube
image: marketplace.gcr.io/google/sonarqube8
ports:
- 127.0.0.1:9000:9000
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- SONARQUBE_JDBC_URL=jdbc:postgresql://some-postgres:5432/sonar
volumes:
- ./sonarqube_conf:/opt/sonarqube/conf
- ./sonarqube_data:/opt/sonarqube/data
- ./sonarqube_extensions:/opt/sonarqube/extensions
- ./sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugin
postgrees:
container_name: some-postgres
image: marketplace.gcr.io/google/postgresql13
environment:
- POSTGRES_USER=sonar
- POSTGRES_PASSWORD=sonar
volumes:
- ./postgresql:/var/lib/postgresql
- ./postgresql_data:/var/lib/postgresql/data
volumes:
sonarqube_conf:
sonarqube_data:
sonarqube_extensions:
sonarqube_bundled-plugins:
postgresql:
postgresql_data:
Run docker network create sonarnetwork
command
then you can use docker run
directly:
docker run -it --rm \
--network sonarnetwork \
--name some-postgrees \
-e POSTGRES_USER=sonar \
-e POSTGRES_PASSWORD=sonar \
-v postgresql:/var/lib/postgresql \
-v postgresql_data:/var/lib/postgresql/data \
-d \
marketplace.gcr.io/google/postgresql13
docker run -it --rm --name some-sonarqube --network sonarnetwork -e SONARQUBE_JDBC_URL=jdbc:postgresql://some-postgres:5432/sonar \
-e SONARQUBE_JDBC_USERNAME=sonar \
-e SONARQUBE_JDBC_PASSWORD=sonar \
-p 127.0.0.1:9000:9000 \
-d \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_data:/opt/sonarqube/data \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins \
marketplace.gcr.io/google/sonarqube8
Default Administrator credentials are usernameadmin
password admin
These are the ports exposed by the container image.
Port | Description |
---|---|
TCP 9000 | Sonarqube web UI service port |
These are the filesystem paths used by the container image.
Variable | Description |
---|---|
SONARQUBE_JDBC_URL | DB Jdbc port could be specified many]ually |
SONARQUBE_JDBC_USERNAME | serive username |
SONARQUBE_JDBC_PASSWORD | service password |
POSTGRES_USER | DB user |
POSTGRES_PASSWORD=sonar | DB password |