0

I'm facing a problem with my docker. I have my own image of SonarQube 3.6.2 which includes a couple a custom rules. I tried to put it in a container, but if I run SonarQube while I'm trying to start my container, then my container keeps on restarting again and again.

I just tried every single idea that I had: ENTRYPOINT (both forms: ENTRYPOINT["/sonarQube362/bin/linux-x86-64/sonar.sh", "start"] and ENTRYPOINT /sonarQube362/bin/linux-x86-64/sonar.sh start), CMD (both forms), using a third party run.sh with these command lines inside:

#!/bin/bash
set -e

#nohup  /sonarQube362/bin/linux-x86-64/sonar.sh start
exec /sonarQube362/bin/linux-x86-64/sonar.sh start

I always have the "Restarting" status on my container and the logs simply complains that Sonar is restarted, again, and again, and again...

If my Dockerfile ends with CMD top for example, then I can docker exec -ti container bash into it and run any of the commands above successfully.

Do you guys have any idea of why, when set as a CMD or an ENTRYPOINT SonarQube/Docker loops restarting?

Cheers,

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
Olivier
  • 1,982
  • 3
  • 23
  • 36
  • What does `docker logs CONTAINER_NAME` show? – jwodder May 31 '16 at 17:41
  • Note that 3.6.2 is an ancient version. 4.5.6 is the current LTS version, and 5.6, the next LTS, is about to be released. – G. Ann - SonarSource Team May 31 '16 at 17:48
  • @jwodder: It simply loops on "SonarQube starting... SonarQube started" – Olivier Jun 01 '16 at 08:26
  • @G.Ann-SonarSourceTeam: I know. Thanks. But I must use 3.6.2 for many reasons, first of all being its provided by my customer, with its own rules and I have contractual commitments on this exact version. (PS: I'm also using JEE6 & Java 6, old but... I have no choice). Anyway, 3.6.2 used to work couple of years ago and should still work... Moreover the problem is not SonarQube 3.6.2 not starting, is SonarQube 3.6.2 not starting automatically with Docker but looping on restart. – Olivier Jun 01 '16 at 08:30

1 Answers1

0

OK. I just found the solution.

I updated the sonar.sh script to change the COMMAND_LINE. It used to daemonize the wrapper, I just changed that to NOT daemonize the wrapper. Thus Docker can keep track of it...

For the sake of clarity, here is the line: Before:

#COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"

After:

COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=FALSE $ANCHORPROP $IGNOREPROP $LOCKPROP"

Of course, you may to this using awk or sed while building the Docker image, but that's another topic...

Hope this helps, Cheers, Olivier

Olivier
  • 1,982
  • 3
  • 23
  • 36