This is the only way to serve SonarQube over HTTPS, so it might be something you still consider.
However, I think you’ll find the Environment Variables documentation useful. If they don’t seem to work… try on 8.3 We had to fix a bug related to them.
Part of it was the variable SONAR_WEB_HOST, but there was also the way that I was doing things in the docker-compose.yml file. I had to make adjustments to the ports also since I had an expose also. I added a test proxy also, and found I still had to make the adjustment.