0

CentOS 7

Docker 20.10.5

In my machine run PostgreSQL 9.5 and success open my db:

localhost:5432/sonar

And success open DB by PGAdmin

Nice.

Now in Docker I installed SonarQube 4.5. And want to connect to my db. I try this:

sudo docker run -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonar sonarqube:4.5.7

But I get error:

2021.04.20 11:47:55 INFO  web[o.s.s.p.ServerImpl]  SonarQube Server / 4.5.7 / e2afb0bff1b8be759789d2c1bc9348de6f519f83
2021.04.20 11:47:55 INFO  web[o.s.c.p.Database]  Create JDBC datasource for jdbc:postgresql://localhost:5432/sonar
2021.04.20 11:47:55 ERROR web[o.a.c.c.C.[.[.[/]]  Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
    at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-4.5.7.jar:na]
    at org.sonar.core.persistence.DefaultDatabase.start(DefaultDatabase.java:73) ~[sonar-core-4.5.7.jar:na]
Alexei
  • 14,350
  • 37
  • 121
  • 240
  • 2
    Does this answer your question? [From inside of a Docker container, how do I connect to the localhost of the machine?](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – maio290 Apr 20 '21 at 11:51
  • @maio290 Yes, it's help. thanks – Alexei Apr 20 '21 at 12:03

0 Answers0