Docker-sonarqube: sonarqube process immediately goes down in 5 seconds

Created on 21 Oct 2017  路  8Comments  路  Source: SonarSource/docker-sonarqube

I'm running next command to start sonarqube docker docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube after that for 5 seconds docker ps shows me docker process and after 5 seconds there is only sonarqube--postgresql left.

There are no errors in the logs:

  • 2017.10.21 00:26:02 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
  • 2017.10.21 00:26:03 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
  • 2017.10.21 00:26:03 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
  • 2017.10.21 00:26:03 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running

  • 2017.10.21 00:26:03 INFO app[][o.e.p.PluginsService] no modules loaded

  • 2017.10.21 00:26:03 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
  • 2017.10.21 00:26:04 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
  • 2017.10.21 00:26:04 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
  • 2017.10.21 00:26:04 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

I think this is an issue with the docker image.

System:

  • macOS Sierra 10.12.6
  • docker CE Version 17.09.0
  • docker-machine version 0.12.2
  • Sonarcube latest 6.6
bug

Most helpful comment

Please build and test from PR #115
Will be merged and published to https://github.com/docker-library/official-images if everything is fine.
Sorry for the inconvenience.

All 8 comments

This is because elasticsearch cannot run as root any longer:

Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.2.jar:5.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.2.jar:5.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]
        ... 6 more

The old workaround by setting the "es.insecure.allow.root"-property does not work anymore in current versions. It needs to run as a non-root-user.

Please build and test from PR #115
Will be merged and published to https://github.com/docker-library/official-images if everything is fine.
Sorry for the inconvenience.

@Godin it's work! Thank you!

Hi @Godin ,
I'd the same issue and I built sonarqube-6.6 branch

Now the error is

ERROR web[][o.s.s.p.Platform] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly
- sonarqube_1  | 2017.10.21 14:06:10 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
- sonarqube_1  | 2017.10.21 14:06:11 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] no modules loaded
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.6.0.32724 / 353296630a2d150f48c76183e82188dfcaa42df0
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://db:5432/sonar
- sonarqube_1  | 2017.10.21 14:06:17 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /sonarqube_1  | 2017.10.21 14:05:58 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
- sonarqube_1  | 2017.10.21 14:05:58 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
- sonarqube_1  | 2017.10.21 14:05:58 INFO  app[][o.s.a.p.ProcessLauncherImpl] Deleting outdated search index data directory /opt/sonarqube/data/es
- sonarqube_1  | 2017.10.21 14:05:59 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
- sonarqube_1  | 2017.10.21 14:05:59 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
- sonarqube_1  | 2017.10.21 14:05:59 INFO  app[][o.e.p.PluginsService] no modules loaded
- sonarqube_1  | 2017.10.21 14:05:59 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
- sonarqube_1  | 2017.10.21 14:06:10 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
- sonarqube_1  | 2017.10.21 14:06:10 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.1.1.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process7598305340246151348properties
- sonarqube_1  | 2017.10.21 14:06:10 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
- sonarqube_1  | 2017.10.21 14:06:11 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] no modules loaded
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
- sonarqube_1  | 2017.10.21 14:06:12 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.6.0.32724 / 353296630a2d150f48c76183e82188dfcaa42df0
- sonarqube_1  | 2017.10.21 14:06:15 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://db:5432/sonar
- sonarqube_1  | 2017.10.21 14:06:17 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
- sonarqube_1  | 2017.10.21 14:06:17 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
- sonarqube_1  | 2017.10.21 14:06:17 ERROR web[][o.s.s.p.Platform] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly.
- sonarqube_1  | 2017.10.21 14:06:19 INFO  app[][o.s.a.SchedulerImpl] Process [web] is stopped
- sonarqube_1  | 2017.10.21 14:06:19 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
- sonarqube_1  | 2017.10.21 14:06:19 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
- sonarqube_1  | 2017.10.21 14:06:19 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
- sonr_sonarqube_1 exited with code 0
  1. docker-compose
version:

 "2"

services:
  sonarqube:
    build: ./docker/6.6
    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:latest
    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:
  1. Dockerfile
    ```FROM openjdk:8

ENV SONAR_VERSION=6.6 \
SONARQUBE_HOME=/opt/sonarqube \
# Database configuration
# Defaults to using H2
SONARQUBE_JDBC_USERNAME=sonar \
SONARQUBE_JDBC_PASSWORD=sonar \
SONARQUBE_JDBC_URL=

Http port

EXPOSE 9000

RUN groupadd -r sonarqube && useradd -r -g sonarqube sonarqube

grab gosu for easy step-down from root

RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true

RUN set -x \

# pub   2048R/D26468DE 2015-05-25
#       Key fingerprint = F118 2E81 C792 9289 21DB  CAB4 CFCA 4A29 D264 68DE
# uid                  sonarsource_deployer (Sonarsource Deployer) <[email protected]>
# sub   2048R/06855C1D 2015-05-25
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE \

&& cd /opt \
&& curl -o sonarqube.zip -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip \
&& curl -o sonarqube.zip.asc -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip.asc \
&& gpg --batch --verify sonarqube.zip.asc sonarqube.zip \
&& unzip sonarqube.zip \
&& mv sonarqube-$SONAR_VERSION sonarqube \
&& chown -R sonarqube:sonarqube sonarqube \
&& rm sonarqube.zip* \
&& rm -rf $SONARQUBE_HOME/bin/*

VOLUME "$SONARQUBE_HOME/data"

WORKDIR $SONARQUBE_HOME
COPY run.sh $SONARQUBE_HOME/bin/
ENTRYPOINT ["./bin/run.sh"]
```

Can you help me please?

@diskomanuelle build: ./docker/6.6 it is real path? maybe ./6.6 ?
I am build image and put it in docker-copmpose file...

@diskomanuelle I suppose that your DB was corrupted by previous unsuccessful start. So either restore working version of DB from backup, or start with fresh empty DB.

@asosnoviy Yes i'd put the docker file in myproject/docker/6.6 the build is Ok .
@Godin It's the first time i have installed sonar. I'll remove all images and retry.
Thank you

It's work. I remove all volumes.
Thanks guys :)

Fix will be available in docker-library after merge of https://github.com/docker-library/official-images/pull/3604

Was this page helpful?
0 / 5 - 0 ratings