Shopware 6 - docker:start fails with non-zero code: 2 - docker

First I pull this repo: https://github.com/shopware/development
Then I want to start a demo shop with command ./psh.phar docker:start in the repo directory.
Then this error appears, and the containers are not biult:
Building app_mysql ... done
Successfully tagged shopware-test_app_mysql:latest
---> Running in e0e02269e83d
Listen 8000
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: no valid OpenPGP data found.
ERROR: for app_server (<Service: app_server>, 'The command \'/bin/sh -c sed -ri -e \'s!VirtualHost \\*:80!VirtualHost \\*:8000!g\' /opt/docker/etc/httpd/vhost.conf && echo "Listen 8000" | tee -a /etc/apache2/ports.conf && curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c \'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list\' && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && sh -c \'echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" >> /etc/apt/sources.list.d/docker.list\' && mkdir -p /usr/share/man/man1 && curl -sL https://deb.nodesource.com/setup_12.x | bash && mkdir -p ${NPM_CONFIG_CACHE} && apt-install default-mysql-client nodejs google-chrome-stable libicu-dev graphviz vim gnupg2 docker-ce=5:18.09.7~3-0~debian-stretch libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb && npm install -g npm#^6.14.11 && npm i forever -g && chown -R ${USER_ID}:${GROUP_ID} ${NPM_CONFIG_CACHE} && ln -s /app/psh.phar /bin/psh && pecl install pcov && docker-php-ext-enable pcov\' returned a non-zero code: 2')
Service 'app_server' failed to build: The command '/bin/sh -c sed -ri -e 's!VirtualHost \*:80!VirtualHost \*:8000!g' /opt/docker/etc/httpd/vhost.conf && echo "Listen 8000" | tee -a /etc/apache2/ports.conf && curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && sh -c 'echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" >> /etc/apt/sources.list.d/docker.list' && mkdir -p /usr/share/man/man1 && curl -sL https://deb.nodesource.com/setup_12.x | bash && mkdir -p ${NPM_CONFIG_CACHE} && apt-install default-mysql-client nodejs google-chrome-stable libicu-dev graphviz vim gnupg2 docker-ce=5:18.09.7~3-0~debian-stretch libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb && npm install -g npm#^6.14.11 && npm i forever -g && chown -R ${USER_ID}:${GROUP_ID} ${NPM_CONFIG_CACHE} && ln -s /app/psh.phar /bin/psh && pecl install pcov && docker-php-ext-enable pcov' returned a non-zero code: 2
Execution aborted, a subcommand failed!
The same happens when I run docker-compose up.
What is the problem there?
I run Xubuntu 18.04. This used to work fine a few weeks ago. What could have happened?
I also opened an issue on Github: https://github.com/shopware/development/issues/161

If you take a look into the error, here:
curl -sL https://dl-ssl.google.com/linux/linux_signing_key.pub |
apt-key add -
download the key and try to use it, but gives you this error:
Warning: apt-key output should not be parsed (stdout is not a terminal)
You should check if in your environment docker is able to download that key and use it

I kind of solved this by updating Xubuntu from 18.04 to 20.04. The apt-key output error remains, but otherwise the containers get built.

I had this issue on ubuntu 22 when docker-compose was not installed, so just run:
sudo apt install docker-compose

Related

Docker image error while installing gcsfuse

I'm trying to install fuse to my docker image that's inside Google Kubernetes Engine.
Here is my Dockerfile:
FROM --platform=amd64 ubuntu:22.10
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Install.
EXPOSE 80
RUN ls -la
RUN \
sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y build-essential && \
apt-get install -y gcc && \
apt-get install -y software-properties-common && \
apt-get install -y cmake && \
apt-get install -y make && \
apt-get install -y clang && \
apt-get install -y mesa-common-dev && \
apt-get install -y git && \
apt-get install -y xorg-dev && \
apt-get install -y nasm && \
apt-get install -y byobu curl git htop man unzip vim wget && \
rm -rf /var/lib/apt/lists/*
# RUN apt-get install -y gobjc++
#RUN apt-get install -y gnupg lsb-release wget
#RUN export DOCKER_DEFAULT_PLATFORM=linux/amd64
#RUN lsb_release -c -s > /tmp/lsb_release
#RUN GCSFUSE_REPO=$(cat /tmp/lsb_release); echo "deb http://packages.cloud.google.com/apt gcsfuse-$GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
#RUN wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get install --yes --no-install-recommends ca-certificates curl gpg gpg-agent
RUN echo "deb http://packages.cloud.google.com/apt gcsfuse-buster main" | tee /etc/apt/sources.list.d/gcsfuse.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get install -y gcsfuse
But when i try to build this image i get this following error:
Step 7/23 : RUN echo "deb http://packages.cloud.google.com/apt gcsfuse-buster main" | tee /etc/apt/sources.list.d/gcsfuse.list
---> Running in c027599dc506
deb http://packages.cloud.google.com/apt gcsfuse-buster main
Removing intermediate container c027599dc506
---> 732f7fb73280
Step 8/23 : RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
---> Running in 47ad78e4351e
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
100 2537 100 2537 0 0 48417 0 --:--:-- --:--:-- --:--:-- 48788
OK
Removing intermediate container 47ad78e4351e
---> 90819264fc33
Step 9/23 : RUN apt-get install -y gcsfuse
---> Running in 8805b3fcaae8
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package gcsfuse
The command '/bin/sh -c apt-get install -y gcsfuse' returned a non-zero code: 100
I'm trying to run this on an ubuntu image inside my docker container to access the Google Cloud Storage inside my container.
I just want to download gcsfuse inside my container, I've tried many things which all ended up with an error but this error seems the most plausible one so I'm asking this one, but if there is a better way to download fuse I could also try that.
I tried the solutions here to no avail:
Github Issue
Stackoverflow Question
I've also tried to implement These two instalations which resulted in different error messages.
Edit: When i try doing it like this:
RUN export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
RUN echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" \
| tee /etc/apt/sources.list.d/gcsfuse.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key add -
RUN apt-get install -y gcsfuse
I get this error:
Step 5/30 : RUN export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
---> Running in 94ee52e0b35f
Removing intermediate container 94ee52e0b35f
---> fa5a33fd2305
Step 6/30 : RUN echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
---> Running in 785cfe4c4d4c
deb http://packages.cloud.google.com/apt main
Removing intermediate container 785cfe4c4d4c
---> f4aaed9a03ae
Step 7/30 : RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
---> Running in 8ccfdfab4681
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 2537 100 2537 0 0 24924 0 --:--:-- --:--:-- --:--:-- 25118
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Removing intermediate container 8ccfdfab4681
---> 9a856aa4bd1a
Step 8/30 : RUN apt-get install -y gcsfuse
---> Running in e4e0445ae72f
E: Malformed entry 1 in list file /etc/apt/sources.list.d/gcsfuse.list (Component)
E: The list of sources could not be read.
The command '/bin/sh -c apt-get install -y gcsfuse' returned a non-zero code: 100
The error is useful:
apt-get install -y gcsfuse ... returned a non-zero error code
You want 0 exit status which means the command succeeeded.
You can then confirm|debug this by trying to install in a container:
docker run \
--interactive --tty --rm \
ubuntu:22.10 \
apt install gcsfuse
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package gcsfuse
Googling gcsfuse provides documentation for install on Linux
You need to install gcsfuse's URL and its public key so that you can apt install it.
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" \
| sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| sudo apt-key add -
Update
FROM --platform=amd64 ubuntu:20.04
RUN apt update && \
DEBIAN_FRONTEND=noninteractive \
TZ=Americas/Los_Angeles \
apt install -y curl lsb-core
RUN export GCSFUSE_REPO=gcsfuse-$(lsb_release -c -s) && \
echo ${GCSFUSE_REPO} && \
( echo "deb http://packages.cloud.google.com/apt ${GCSFUSE_REPO} main" \
| tee /etc/apt/sources.list.d/gcsfuse.list ) && \
more /etc/apt/sources.list.d/gcsfuse.list && \
( curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key add - )
RUN apt update && apt -y install gcsfuse
ENTRYPOINT ["gcsfuse"]
CMD ["--help"]
If you use the following in your dockerfile, it will solve your issues with installing gcsfuse to your gke container :
ENV GCSFUSE_REPO gcsfuse-stretch
ENV GOOGLE_APPLICATIONS_CREDENTIALS=test-serviceaccount.json
ENV GCS_BUCKET: "my-bucket"
ENV GCS_BUCKET_FOLDER: "shared-data"
USER root
# Add google repositories for gcsfuse and google cloud sdk
RUN apt-get update -y && apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl gnupg
RUN echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
RUN echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
# Install gcsfuse and google cloud sdk
RUN apt-get update -y && apt-get install -y gcsfuse google-cloud-sdk \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

SBT not running from root directory

FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
I'm getting an error saying E: Version '1.5.8' for 'sbt' was not found
I had to change my work directory away from default / to get this to work. Try below (WORKDIR changes folder, cd in the commands likely have the same effect) could. This builds and runs with sbt command for me.
FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
WORKDIR $APP_HOME
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
root#a94ff4797239:/service# sbt
[info] welcome to sbt 1.5.8 (Oracle Corporation Java 1.8.0_312)
[info] loading project definition from /service/project
[info] set current project to service (in build file:/service/)
[info] sbt server started at local:///root/.sbt/1.0/server/c75bcef1d951ec508da8/sock
[info] started sbt server
sbt:service>

Docker M1 - Using Ubuntu + MySQL: /bin/sh errors on latest update Docker Desktop 4.2.0

I'm struggling to get build my project after updating my Docker.
My previous working DockerFile:
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
&& mkdir -p ~/.gnupg \
&& chmod 600 ~/.gnupg \
&& echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \
&& echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php7.4-cli php7.4-dev \
php7.4-pgsql php7.4-sqlite3 php7.4-gd \
php7.4-curl php7.4-memcached \
php7.4-imap php7.4-mysql php7.4-mbstring \
php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \
php7.4-intl php7.4-readline php7.4-pcov \
php7.4-msgpack php7.4-igbinary php7.4-ldap \
php7.4-redis \
&& php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sL https://deb.nodesource.com/setup_15.x | bash - \
&& apt-get install -y nodejs \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
With the Platform: platform: linux/x86_64 in my Docker-Compose.
However, it now isn't working after updating Docker and I'm clueless why.
Returns the response now of:
After this operation, 116 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_15.x focal/main arm64 nodejs
arm64 15.14.0-deb-1nodesource1 [24.8 MB] debconf: delaying package
configuration, since apt-utils is not installed Fetched 24.8 MB in 2s
(12.5 MB/s) Selecting previously unselected package nodejs. (Reading
database ... 21576 files and directories currently installed.)
Preparing to unpack .../nodejs_15.14.0-deb-1nodesource1_arm64.deb ...
Unpacking nodejs (15.14.0-deb-1nodesource1) ... Setting up nodejs
(15.14.0-deb-1nodesource1) ... Processing triggers for man-db
(2.9.1-1) ... Warning: apt-key output should not be parsed (stdout is
not a terminal) gpg: no valid OpenPGP data found. Segmentation fault 1
error occurred:
* Status: The command '/bin/sh -c apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git
supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p
~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >>
~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver
hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb
http://ppa.launchpad.net/ondrej/php/ubuntu focal main" >
/etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update
&& apt-get install -y php7.4-cli php7.4-dev php7.4-pgsql
php7.4-sqlite3 php7.4-gd php7.4-curl php7.4-memcached
php7.4-imap php7.4-mysql php7.4-mbstring php7.4-xml php7.4-zip
php7.4-bcmath php7.4-soap php7.4-intl php7.4-readline
php7.4-pcov php7.4-msgpack php7.4-igbinary php7.4-ldap
php7.4-redis && php -r
"readfile('http://getcomposer.org/installer');" | php --
--install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_15.x | bash - && apt-get install
-y nodejs && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable
main" > /etc/apt/sources.list.d/yarn.list && apt-get update &&
apt-get install -y yarn && apt-get install -y mysql-client &&
apt-get install -y postgresql-client && apt-get -y autoremove
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*'
returned a non-zero code: 2, Code: 2
Steps tried (Specifying Ubuntu version in case there's some incompatibilities):
FROM --platform=linux/arm64/v8 ubuntu:18.04
Error 1: Unable to locate package python2
FROM --platform=linux/arm64/v8 ubuntu:21.04
Error 1: The following packages have unmet dependencies: libxml2 :
Depends: libicu66 (>= 66.1-1~) but it is not installable php7.4-intl
: Depends: libicu66 (>= 66.1-1~) but it is not installable
Error 2: Unable to correct problems, you have held broken packages. 1
error occurred: Status: The command '/bin/sh -c [....] returned a
non-zero code: 100, Code: 100
FROM --platform=linux/arm64/v8 ubuntu:22.04
Error 1: The following packages have unmet dependencies: libxml2 :
Depends: libicu66 (>= 66.1-1~) but it is not installable php7.4-intl
: Depends: libicu66 (>= 66.1-1~) but it is not installable
Error 2: Unable to correct problems, you have held broken packages. 1
error occurred: Status: The command '/bin/sh -c [....] returned a
non-zero code: 100, Code: 100
Docker-Compose:
I have specified my platform to now be platform: linux/amd64rather than platform: linux/x86_64 as per to the docs. Tried using linux/arm64 but that didn't work either (Same errors produced).
Fixed it, I was being an idiot yesterday night.
Solution A: (In my case): Downgrade back to Docker Desktop version 4.0.0. I was using Intel Images so that's why I had to specify x86_64.
A more better solution would to change all my images be Arm64 and Intel based as well as it being compatible with Ubuntu + Mysql (currently docker Is recommending to use MariaDB for now)
However - seeing that Docker is still relatively unstable and can stop your build process at any moment, I advise anyone to update the Docker for M1 with caution!

Install google-chrome-stable with docker

I get an error when I do docker-compose build.
I am using apple siilcon and I was able to build it with intel without any problems.
Does anyone know if something is wrong?
Contents of docker
RUN apt-get update && apt-get install -y unzip && \
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/ && \
unzip ~/chromedriver_linux64.zip -d ~/ && \
rm ~/chromedriver_linux64.zip && \
chown root:root ~/chromedriver && \
chmod 755 ~/chromedriver && \
mv ~/chromedriver /usr/bin/chromedriver && \
sh -c 'wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get update
RUN apt-get install -y google-chrome-stable
Error
=> ERROR [ 5/15] RUN apt-get install -y google-chrome-stable 3.2s
------
> [ 5/15] RUN apt-get install -y google-chrome-stable:
#8 1.090 Reading package lists...
#8 2.038 Building dependency tree...
#8 2.154 Reading state information...
#8 2.214 E: Unable to locate package google-chrome-stable
You can add the platform flag to the FROM statement in your Dockerfile. This will ensure the docker container builds the correct architecture every time.
I used this for Debian Linux and Chrome headless:
FROM --platform=linux/amd64 python:3.9

Running Sonarqube on Openshift ends in error "ImagePullBackOff"

I try to set up the latst sonarqube Version on Openshift.
When deploying the image the pod creation fails:
pulling image "sonarqube#sha256:6aa9f0f580fd94afd65702ceb09615ce7abd0aa1e9093168343c11d2f29a2cb0
Failed to pull image "sonarqube#sha256:6aa9f0f580fd94afd65702ceb09615ce7abd0aa1e9093168343c11d2f29a2cb0": rpc error: code = Unknown desc = manifest for registry.centos.org/sonarqube#sha256:6aa9f0f580fd94afd65702ceb09615ce7abd0aa1e9093168343c11d2f29a2cb0 not found
Error: ErrImagePull
Error: ImagePullBackOff
Back-off pulling image "sonarqube#sha256:6aa9f0f580fd94afd65702ceb09615ce7abd0aa1e9093168343c11d2f29a2cb0"
What is wrong here?
I am using the sonarqube image from dockerhub:
https://hub.docker.com/layers/sonarqube/library/sonarqube/7.4-community/images/sha256-df1feff9aacfa2bab099f11b0cd40b89b4f0296c86bbdacba9a0e993a3a53d42
ADD file:da71baf0d22cb2ede91c5e3ff959607e47459a9d7bda220a62a3da362b0e59ea in /
CMD ["bash"]
/bin/sh -c apt-get update && apt-get install -y --no-install-recommends ca-certificates curl netbase wget && rm -rf /var/lib/apt/lists/*
/bin/sh -c set -ex; if ! command -v gpg > /dev/null; then apt-get update; apt-get install -y --no-install-recommends gnupg dirmngr; rm -rf /var/lib/apt/lists/*; fi
/bin/sh -c apt-get update && apt-get install -y --no-install-recommends bzr git mercurial openssh-client subversion procps && rm -rf /var/lib/apt/lists/*
/bin/sh -c apt-get update && apt-get install -y --no-install-recommends bzip2 unzip xz-utils && rm -rf /var/lib/apt/lists/*
ENV LANG=C.UTF-8
/bin/sh -c { echo '#!/bin/sh'; echo 'set -e'; echo; echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; } > /usr/local/bin/docker-java-home && chmod +x /usr/local/bin/docker-java-home
/bin/sh -c ln -svT "/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)" /docker-java-home
ENV JAVA_HOME=/docker-java-home
ENV JAVA_VERSION=8u181
ENV JAVA_DEBIAN_VERSION=8u181-b13-2~deb9u1
/bin/sh -c set -ex; if [ ! -d /usr/share/man/man1 ]; then mkdir -p /usr/share/man/man1; fi; apt-get update; apt-get install -y --no-install-recommends openjdk-8-jdk="$JAVA_DEBIAN_VERSION" ; rm -rf /var/lib/apt/lists/*; [ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; update-alternatives --query java | grep -q 'Status: manual'
ENV SONAR_VERSION=7.4 SONARQUBE_HOME=/opt/sonarqube SONARQUBE_JDBC_USERNAME=secret SONARQUBE_JDBC_PASSWORD=secret SONARQUBE_JDBC_URL=
EXPOSE 9000
/bin/sh -c groupadd -r sonarqube && useradd -r -g sonarqube sonarqube
/bin/sh -c 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 ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 || gpg --batch --keyserver ipv4.pool.sks-keyservers.net --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
/bin/sh -c set -x && (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 [/opt/sonarqube/data]
WORKDIR /opt/sonarqube
COPY file:108dc63c48e0f9caa767ef121de21a22716e7e01b409a40c32da36ee92cbf013 in /opt/sonarqube/bin/
USER sonarqube
ENTRYPOINT ["./bin/run.sh"]
Your pod is most likely failing because of the dreaded ElasticSearch vm.max_map_count requirement which by default is set to low on many host machines. If you're running Openshift 4.x you can change this value pretty easily with the Node Tuning Operator:
Save the following yaml as sonarqube-tuning.yml:
apiVersion: tuned.openshift.io/v1
kind: Tuned
metadata:
name: maxmapcount
namespace: openshift-cluster-node-tuning-operator
spec:
profile:
- data: |
[main]
summary=A custom profile to update the vm.max_map_count
[sysctl]
vm.max_map_count=262144
name: max-map-count
recommend:
- match:
- label: tuned.openshift.io/max-map-count-label
value: max-map-count
type: pod
priority: 10
profile: max-map-count
Then apply it:
oc apply -f sonarqube-tuning.yml
And when you create the sonarqube deployment, just make sure to add the label that matches the label in the yml above:
labels:
tuned.openshift.io/max-map-count-label: max-map-count
If you're running openshift 3, you're going to need to apply the vm.max_map_count to your sysctl on each node (eg. you could script it when you deploy the cluster)

Resources