What you should do when you have Sonar in docker and you can't remember, which password you have for your admin user? If you use internal H2 database it is not so easy...
First of all connect to your docker container:
docker exec -it container_id /bin/bash
Then run following commands to connect to H2 database:
cd /opt/sonarqube/lib/jdbc/h2
java -cp h2-1.4.199.jar org.h2.tools.Shell
You will be asked to fill following values:
URL jdbc:h2:tcp://localhost:9092/sonar
Driver org.h2.Driver
User [none]
Password [none]
Then just change your admin password:
UPDATE users SET crypted_password = '$2a$12$uCkkXmhW5ThVK8mpBvnXOOJRLd64LJeHTeCkSuB3lfaR2N0AYBaSi', salt=null, hash_method='BCRYPT' WHERE login = 'admin'