docker container directory gets overwritten by persistent volume (claim)
to avoid overwriting data to the the existing files/content inside the same Directory, you can use subpath to mount the data and extensions directory (In the example below) in the existing Container file system. for further detail sub-path
volumeMounts: - mountPath: "/opt/sonarqube/data" name: sonarqube-data subPath: data - mountPath: "/opt/sonarqube/extensions" name: sonarqube-extensions subPath: extensions
This works. However it didn't work until I did the same for the database that sonarqube is using:
volumeMounts: - mountPath: /var/lib/postgresql/data name: sonarqubedb subPath: data