Closed ghost closed 6 years ago
I haven't been able to reproduce on Ubuntu with Docker version 18.06.1-ce, tried with and without passing docker options. Maybe it's an image corruption, you could try purging the layers and repulling
I tried to run purged image on Ubuntu 18.04.1 with docker-ce 18.09.0, and it still has problem:
$ docker -v
Docker version 18.09.0, build 4d60db4
$ docker run sonarqube:6.7-alpine
2018.11.27 04:13:46 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2018.11.27 04:13:46 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.11.27 04:13:46 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
2018.11.27 04:13:46 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.11.27 04:13:46 INFO app[][o.e.p.PluginsService] no modules loaded
2018.11.27 04:13:46 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.11.27 04:13:53 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2018.11.27 04:13:53 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-1.8-openjdk/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/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process6392450656198437664properties
Error: Could not find or load main class org.sonar.server.app.WebServer
2018.11.27 04:13:53 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [web]: 1
2018.11.27 04:13:53 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped
2018.11.27 04:13:53 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.11.27 04:13:53 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
2018.11.27 04:13:53 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
I can reproduce, but unfortunately don't have any ideas for root cause. Java on Alpine is pretty experimental to begin with (to put it lightly). There was an effort to make it officially supported for OpenJDK 11, but it didn't get the attention it needed to in time, so was removed at the final GA release. See https://github.com/docker-library/openjdk/issues/211, especially https://github.com/docker-library/openjdk/issues/211#issuecomment-438173628 (and also https://github.com/docker-library/openjdk/pull/235#issuecomment-424599754).
Not sure why, but it randomly successes even on Ubuntu.
And following patch for docker-sonarqube can stabilize this behaviour. Maybe this is related with user, permission or workdir for launched process by ProcessBuilder, I guess.
diff --git a/6.7.5-alpine/Dockerfile b/6.7.5-alpine/Dockerfile
index b1fc9e6..606dcf0 100644
--- a/6.7.5-alpine/Dockerfile
+++ b/6.7.5-alpine/Dockerfile
@@ -42,3 +42,5 @@ VOLUME "$SONARQUBE_HOME/data"
WORKDIR $SONARQUBE_HOME
COPY run.sh $SONARQUBE_HOME/bin/
ENTRYPOINT ["./bin/run.sh"]
+RUN chown -R sonarqube:sonarqube $SONARQUBE_HOME
+USER sonarqube
diff --git a/6.7.5-alpine/run.sh b/6.7.5-alpine/run.sh
index e1da369..a90c203 100755
--- a/6.7.5-alpine/run.sh
+++ b/6.7.5-alpine/run.sh
@@ -7,8 +7,7 @@ if [ "${1:0:1}" != '-' ]; then
fi
chown -R sonarqube:sonarqube $SONARQUBE_HOME
-exec su-exec sonarqube \
- java -jar lib/sonar-application-$SONAR_VERSION.jar \
+java -jar lib/sonar-application-$SONAR_VERSION.jar \
-Dsonar.log.console=true \
-Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
-Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
Very. Interesting. BIG thank you @KengoTODA! This seems to do the trick, the alpine-based image no longer crashes.
A small thing, with this change, I'm no longer able to stop a running container with Ctrl-C, I need to use docker
commands to stop it. Does that ring any bells? Is that an issue? (I'm new to Docker.)
If I change java -jar ...
to exec java -jar ...
, then Ctrl-C works as before. Does that seem like a good solution?
That'd be because you dropped "exec" so the shell is still active as PID 1 and as such the signals get eaten there instead of passing forward to Java.
Closing since this does not seem to be an issue with the openjdk image and is being addressed in the sonarqube image.
I'm puzzled by crashes at runtime of SonarQube built on top of
openjdk:8-alpine
, on Linux hosts.Relevant log from the crash of SonarQube 6.7.5-alpine:
Relevant log from the crash of SonarQube 6.7.6-community-alpine, same as from 7.4-community-alpine:
I run the built images with the simplest possible command,
docker run imagename
.If I do the same on OSX, it works, I only get the above errors on Linux.
I see others have similar issues, strangely on first run only. For example if I run
docker run -it imagename bash
, and then within the container/opt/sonarqube/bin/run.sh
, the first run fails and the 2nd and subsequent runs work fine.What's going on?