How to persist configuration & analytics across container invocations in Sonarqube docker image

前端 未结 3 1598
感情败类
感情败类 2020-12-31 18:21

Sonarqube official docker image, is not persisting any configuration changes like: creating users, changing root password or even installing new plugins.

3条回答
  •  太阳男子
    2020-12-31 18:52

    Hi @VanagaS and others landing here.

    I just wanted to provide an alternative to the above. Maybe some would even consider it an easier one.

    Notice this line SONARQUBE_HOME in the Dockerfile for the docker-sonarqube image. We can control this environment variable.

    When using docker run. Simply do:

    txt docker run -d \ ... ... -e SONARQUBE_HOME=/sonarqube-data -v /PERSISTENT_DISK/sonarqubeVolume:/sonarqube-data

    This will make Sonarqube create the conf, data and so forth folders and store data therein. As needed.


    Or with Kubernetes. In your deployment YAML file. Do:

    txt ... ... env: - name: SONARQUBE_HOME value: /sonarqube-data ... ... volumeMounts: - name: app-volume mountPath: /sonarqube-data

    And the name in the volumeMounts property points to a volume in the volumes section of the Kubernetes deployment YAML file. This again will make Sonarqube use the /sonarqube-data mountPath for creating extenions, conf and so forth folders, then save data therein.

    And voila your Sonarqube data is thereby persisted.

    I hope this will help others.

    N.B. Notice that the YAML and Docker run examples are not exhaustive. They focus on the issue of persisting Sonarqube data.

提交回复
热议问题