When I build an image in Docker (docker build . -t sonar) and run the container (docker run -d --name sonar -p 8080:9000 sonar) , the properties inside sonar.properties are not picket up by the installation of sonarqube.
for testing purposes I wiped the sonar.properties to only put 1 line (the first in the admin - system screen) in that properties file to see if it gets picked up. Can anyone tell what is going on?
=========================================
Dockerfile:
FROM openjdk:8-alpine
# Specify plugin versions
ENV JAVA_PLUGIN_VERSION 5.4.0.14284
ENV WEB_PLUGIN_VERSION 2.6.0.1053
ENV JS_PLUGIN_VERSION 4.1.0.6085
ENV GIT_PLUGIN_VERSION 1.4.1.1128
ENV GITLAB_PLUGIN_VERSION 3.0.1
ENV GITLAB_AUTH_PLUGIN_VERSION 1.3.2
ENV PMD_PLUGIN_VERSION 2.5
ENV CHECKSTYLE_PLUGIN_VERSION 4.10.1
RUN apk add --update-cache \
bash \
curl && \
rm -rf /var/cache/apk/*
ENV SONAR_VERSION=7.1 \
SONARQUBE_HOME=/opt/sonarqube
# Database configuration
# Defaults to using H2
# Http port
EXPOSE 9000
RUN addgroup -S sonarqube && adduser -S -G sonarqube sonarqube
RUN set -x \
&& apk add --no-cache gnupg unzip \
&& apk add --no-cache libressl wget \
&& apk add --no-cache su-exec \
&& apk add --no-cache bash \
# pub 2048R/D26468DE 2015-05-25
# Key fingerprint = F118 2E81 C792 9289 21DB CAB4 CFCA 4A29 D264 68DE
# uid sonarsource_deployer (Sonarsource Deployer) <infra@sonarsource.com>
# sub 2048R/06855C1D 2015-05-25
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE \
&& mkdir /opt \
&& cd /opt \
&& wget -O sonarqube.zip --no-verbose https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip \
&& wget -O sonarqube.zip.asc --no-verbose 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/
COPY sonar.properties $SONARQUBE_HOME/conf/
ENTRYPOINT ["./bin/run.sh"]
==========================
run.sh
#!/bin/sh
set -e
if [ "${1:0:1}" != '-' ]; then
exec "$@"
fi
chown -R sonarqube:sonarqube $SONARQUBE_HOME
exec su-exec sonarqube \
java -jar lib/sonar-application-$SONAR_VERSION.jar \
-Dsonar.log.console=true \
-Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \
"$@"
=================================================
sonar.properties
sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnap=2