Deploying SonarQube on Azure App Service Webapp Container - issues not connecting to Azure SQL Database

I am trying to build sonarqube image version 8.7.0 community using Dockerfile along with two files (,
(docker-sonarqube/8/community at 7e2c6a2bf55a250c332f8e4bacf0a1fe87264ebf · SonarSource/docker-sonarqube · GitHub) through Azure DevOps pipeline on Azure App service for Webapp Container. I am pushing the image first to Azure Container Registry then Azure app service pulls the image from ACR.
As part of Azure Infrastructure, I have created all resources like Azure App Service, Azure SQL Server and Azure SQL Database.

I have these followings azure app settings:

  • sonar.jdbc.password: password

  • sonar.jdbc.username: username

  • sonar.jdbc.url: jdbc:sqlserver://;database=sonar;user=username@sonarqube-elastic-sql;password=password;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*;loginTimeout=30;

  • sonar.web.javaAdditionalOpts:



Sonarqube webapp is working find but when I looked at Adminsitration>System: then found below:
:-Database = H2

  • URL = jdbc:h2:tcp://
  • Driver = H2 JDBC Driver

Also, I am attaching my dockerfile and and files

Please note: I have also includedDockerfile (1).txt (7.2 KB) init_container.txt (2.2 KB) sonar.txt (108 Bytes) SSH part in the attached dockerfile.

But it seems neither SSH nor SQL Databse is working.

Please let me know if you need more information.

Thank you

Hello @goyalg8 and welcome to the community :wave:

glad you made it from the github issue to the community forum :slight_smile:

i am not sure how this is parsed and injected into the running container at the end, but if these are environment variables, they are wrong. please have a look at our documentation about configuring sonarqube using environment variables.

any reason you need to have ssh access to a container? this is kind of an anti pattern.
i did have a short look and i think you need to generate keys for the container as well in order to start sshd

bash-5.0# /usr/sbin/sshd
sshd: no hostkeys available – exiting.
bash-5.0# ssh-keygen -A
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
bash-5.0# /usr/sbin/sshd

Hi Tobias,
I am not sure if you have used Azure Web Service for web app container. I am trying to use Sonarqube dockerfile and hosted on Azure App service web app container. I want to use Azure SQL Database not H2. how did I check if sonarqube is using Azure SQL database.

Secondly, I want to enable SSH in the container for diagnostic purpose in the future. I have included SSH as per below Microsoft documentation:

I am passing sonar.jdbc.username etc in azure app setting and has following environment variables

# Deprecated environment variable mapping that will be removed in future versions.

# Please use environment variables from

# instead of using these 4 environment variables below.


set_prop_from_deprecated_env_var "sonar.jdbc.username" "${sonarqube.jdbc.username:-}"

set_prop_from_deprecated_env_var "sonar.jdbc.password" "${sonarqube.jdbc.password:-}"

set_prop_from_deprecated_env_var "sonar.jdbc.url" "${sonarqube.jdbc.url:-}"

set_prop_from_deprecated_env_var "sonar.web.javaAdditionalOpts" "${sonarqube.web.jvm.opts:-}"

Can you please identify which env variables should be in file.

Many thanks

Further update, finally I am able to connect to Azure SQL database. Sonarqube website is working. but I am unable to do SSH into Azure Web App Container.

Anybody knows what should I include in SonarQube 8.7.0 community dockerfile so that SSH functionality can be enabled.


Hi Tobias,
I am able to connect to Azure SQL database with sonarqube but still not able to do SSH into Azure web app container.
As you said I need to generate keys for the container, so how/where to put these lines into dockerfile to enable SSH.


Hi @goyalg8 ,

glad you got the database connection figured out :slight_smile:

you are still using rc-service to start sshd? the keys can be configured anytime in the Dockerfile after you have installed openssh-server, but it will probably start on port 22 and you have port 2222 exposed in your Dockerfile, so make sure that your sshd configuration reflects this. The sshd docs will probably help you with this.

Hi @Tobias_Trabelsi,
I am using this in my file

echo “Starting SSH Service”
rc-service sshd start

Below is the SSH part in my Dockerfile

install SSH Server

COPY /opt/startup/

COPY sshd_config /etc/ssh/

RUN apk add --update openssh-server \

&& echo “root:Docker!” | chpasswd \

&& apk update && apk add openrc \

&& sed -i ‘s/\tcgroup_add_service/\t#cgroup_add_service/g’ /lib/rc/sh/ \

&& chmod 755 /opt/startup/ \

&& apk add --no-cache bash;

I have also followed the Microsoft documentation to enable SSH as per below:

I am using port 2222 in my sshd_config file. Azure webapp container SSH (WebSSH) listens on port 2222.

I am still wondering that do I still need to create ssh keys to make it SSH work. is this requirement to have ssh-keygen in the dockerfile.

Thank you for your support

yes this is a requirement from sshd. without server keys this will not work.

are there any logs if sshd is actually starting with the container? have you checked locally if everything is working correctly?

Hi @Tobias_Trabelsi ,
Finally, I am able to do WebSSH into Azure Web App Linux container for Sonarqube after including server keys part in the bash files.

Thank you for your help. It was a great learning.


Happy to help and now have fun analyzing your projects with sonarqube :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.