hi @Pierre Guillot and Team
Due to issue : https://jira.sonarsource.com/browse/SONAR-12501, i started using -e environment variable flag as mentioned in link
[i am running sonarQube and PostgreSQL on same EC2 instance]
docker run -d --name sonarqube -p 9000:9000 -e SONARQUBE_JDBC_USERNAME=sonarqubeuser -e SONARQUBE_JDBC_PASSWORD=passw0rd -e SONARQUBE_JDBC_URL=jdbc:postgresql://HostIP:5432/dbname sonarqube
But container stops after few seconds. This issue has been reported by many people and solution to this which is below was already ran on host BUT STILL SAME ISSUE.
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 4096
Can you please tell any solution ? Many people are facing this issue.
Hi @Amit_Malhotra and welcome to the community
,
while i am not Pierre i might be able to help you if you could provide some logs about the actual error (docker logs sonarqube based on your snippet) 
1 Like
Ah i see that you posted some more information in another thread. please stick to one in the future that makes it easier to track.
i have installed postgreSQL(not image) in EC2 and same EC2 , i ran sonarqube latest docker image with below command , but i get same error as “java.lang.IllegalStateException: Can not connect to database”
if the database connection can not be established, please check if there is a security group entry that blocks the traffic from your sonarqube host to your database host, or vice versa. you might be able to check this fast using the postgresql cli. if this is able to initiate a connection to your database, so is sonarqube. if not then you might need to check your infrastructure and/or database configuration