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,
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