<p>I ran into the same issue and found this docker-compose file that is able to start postgres and sonarqube.</p>

<p><a href="https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md" rel="nofollow noreferrer">https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md</a></p>

<blockquote>
<pre><code>version: "2"

services:
  sonarqube:
    image: sonarqube
    ports:
      - "9000:9000"
    networks:
      - sonarnet
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
    volumes:
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins

  db:
    image: postgres
    networks:
      - sonarnet
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar
    volumes:
      - postgresql:/var/lib/postgresql
      # This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
      - postgresql_data:/var/lib/postgresql/data

networks:
  sonarnet:
    driver: bridge

volumes:
  sonarqube_conf:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_bundled-plugins:
  postgresql:
  postgresql_data:
</code></pre>
</blockquote>

CC BY-SA 3.0
2017-11-26T19:30:22.453Z
2017-11-26T19:30:22.453Z
030
<p>I am running an init.sh script in order to create mapped directories for Sonar and Postgres.</p>

<p>Both of the containers build fine and are able to be started, but for some reason, our Sonar container is in a constant restart loop after about 8-16 seconds. </p>

<p>In the logs we noticed that there was a missing plugin error for <code>"findbugs"</code>, although the compability matrix states that <code>findbugs</code> works with Sonar 6.7.</p>

<pre><code>        2017.11.23 17:16:21 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
     java.lang.Object.wait(Native Method)
     java.util.TimerThread.mainLoop(Timer.java:552)
     java.util.TimerThread.run(Timer.java:505)
</code></pre>

<p>This seems to be a popular error when I do a <code>sudo docker logs sonar_container</code></p>

<p>Restarting: </p>

<pre><code>VirtualBox:~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           16 seconds ago      Up 5 seconds        0.0.0.0:9092-&gt;9092/tcp, 0.0.0.0:8060-&gt;9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432-&gt;5432/tcp                           pgsql_container
:~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           19 seconds ago      Up 9 seconds        0.0.0.0:9092-&gt;9092/tcp, 0.0.0.0:8060-&gt;9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432-&gt;5432/tcp                           pgsql_container
~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           23 seconds ago      Up 12 seconds       0.0.0.0:9092-&gt;9092/tcp, 0.0.0.0:8060-&gt;9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432-&gt;5432/tcp                           pgsql_container
~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                        PORTS                    NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           25 seconds ago      Restarting (0) 1 second ago  
</code></pre>

<p>Does anyone have any experience with fixing this issue?</p>

CC BY-SA 4.0
2019-12-23T08:24:52.233Z
Could you indicate whether you solved the issue?
030
<docker>
Sonar:6.7 docker container restart loop
dburke1
# Sonar:6.7 docker container restart loop

(Asked by: username_0 on 2017-11-24)

I am running an init.sh script in order to create mapped directories for Sonar and Postgres.
Both of the containers build fine and are able to be started, but for some reason, our Sonar container is in a constant restart loop after about 8-16 seconds. 
In the logs we noticed that there was a missing plugin error for "findbugs", although the compability matrix states that findbugs works with Sonar 6.7.
        2017.11.23 17:16:21 WARN  web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
     java.lang.Object.wait(Native Method)
     java.util.TimerThread.mainLoop(Timer.java:552)
     java.util.TimerThread.run(Timer.java:505)

This seems to be a popular error when I do a sudo docker logs sonar_container
Restarting: 
VirtualBox:~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           16 seconds ago      Up 5 seconds        0.0.0.0:9092->9092/tcp, 0.0.0.0:8060->9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432->5432/tcp                           pgsql_container
:~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           19 seconds ago      Up 9 seconds        0.0.0.0:9092->9092/tcp, 0.0.0.0:8060->9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432->5432/tcp                           pgsql_container
~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           23 seconds ago      Up 12 seconds       0.0.0.0:9092->9092/tcp, 0.0.0.0:8060->9000/tcp   sonar_container
87db675ef2dd        postgres:9.5        "docker-entrypoint..."   18 hours ago        Up 11 minutes       0.0.0.0:5432->5432/tcp                           pgsql_container
~/Sonar/docker-sonar-scpvm014$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                        PORTS                    NAMES
fa4b1c86433d        sonarqube:lts       "./bin/run.sh"           25 seconds ago      Restarting (0) 1 second ago  

Does anyone have any experience with fixing this issue?

**Tags:** docker

> **Comments:**
> **username_1**: Could you indicate whether you solved the issue?  

---

## 1 answers

### Answer by username_1 on 2017-11-26. Score: 1

I ran into the same issue and found this docker-compose file that is able to start postgres and sonarqube.
https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md

version: "2"

services:
  sonarqube:
    image: sonarqube
    ports:
      - "9000:9000"
    networks:
      - sonarnet
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
    volumes:
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins

  db:
    image: postgres
    networks:
      - sonarnet
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar
    volumes:
      - postgresql:/var/lib/postgresql
      # This needs explicit mapping due to https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
      - postgresql_data:/var/lib/postgresql/data

networks:
  sonarnet:
    driver: bridge

volumes:
  sonarqube_conf:
  sonarqube_data:
  sonarqube_extensions:
  sonarqube_bundled-plugins:
  postgresql:
  postgresql_data:


---

