Dockerfile for SonarQube 7.6

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi,

I am trying to build a docker image for SonarQube 7.6 using the Dockerfile present in the Sonarqube repository on Github.

Now using the Dockerfile as below:
FROM openjdk:8

ENV SONAR_VERSION=7.6
SONARQUBE_HOME=/opt/sonarqube
# Database configuration
# Defaults to using H2
# DEPRECATED. Use -v sonar.jdbc.username=… instead
# Drop these in the next release, also in the run script
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 --batch --keyserver keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
|| gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
|| gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
|| gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
|| gpg --batch --keyserver pgp.mit.edu --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) infra@sonarsource.com
# sub 2048R/06855C1D 2015-05-25
&& (gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE
|| gpg --batch --keyserver ipv4.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE)
&& cd /opt
&& curl -o sonarqube.zip -fSL https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip
&& curl -o sonarqube.zip.asc -fSL https://binaries.sonarsource.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/
USER sonarqube
ENTRYPOINT ["./bin/run.sh"]

Now, this gives me an error as follows:
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
gpg: keybox ‘/tmp/tmp.W8UP9YEiTl/pubring.kbx’ created
gpg: keyserver receive failed: Connection timed out

  • gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0

It’s either No Keys found or Connection timed out.

Is there any alternative to using Gosu as the key is not present in either of the host servers?

Or can I skip using Gosu?

Hi,

Welcome to the community!

Why not just start from the Docker images available for 8.1 instead of building your own for a deprecated version?

 
:slightly_smiling_face:
Ann

Hi,
Ya but I’m currently using SonarQube 7.6, need to move it to dockers before I migrate my SonarQube to its latest version.

Why?

Spin up a non-Docker version of 7.9.2 to handle the first required DB upgrade, then spin up a SonarSource-issued 8.1 Docker image (you’ll need to run SQ’s DB upgrade for this too, obviously).

 
Ann