How to change admin account password in Docker Image for Kubernetes deployment?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    I use a helm chart with a sonarqube image version of 7.9.2
  • what are you trying to achieve
    Change the admin’s password during initialisation stage of deploying a pod in a Kubernetes cluster.
  • what have you tried so far to achieve this
    I haven’t tried anything as there was no explicit instructions on sonarqube documentations or docker hub page.

I would like to change the admin’s password for the purpose of security when deploying a SonarQube helm chart in a Kubernetes cluster.
I struggled to find such information about this, but I did find a detail somewhere that you can find the user in a ‘local’ database. I wasn’t sure whether it was a production database or something that Sonarqube manages.
I have seen this solution to reinstate an admin user, but I was thinking whether there was a cleaner solution as to configure a different password.



when I have a similar requirement I use the REST API to do the change - I am not keen on directly accessing the SonarQube DB.
You can find the relevant documentation (on a 7.9 version, not sure the url is the same on version 8) at the following url: ${SONAR_URL}/web_api/api/users


Hi, indeed you can do something like this, once sonarqube is fully started :

curl -u admin:admin -X POST "http://localhost:9000/api/users/change_password?login=admin&previousPassword=admin&password=XXXXXXXXX"
1 Like

Ok @pierreguillot and @Vincent_Klock for your replies! Greatly appreciated!