Docker-sonarqube: 7.4 fails to run on kubernetes

Created on 28 Nov 2018  Â·  9Comments  Â·  Source: SonarSource/docker-sonarqube

I've built an image with the current 7.4-community dockerfile but, when I try to run it in my kubernetes cluster, it fails with this error:

error: failed to start container "sonarqube": Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"./bin/run.sh\": permission denied": unknown

If I override the ENTRYPOINT with a shell, I can get the pod running. Exec'ing into it, I still cannot manually run the run.sh file (permission denied).
The run.sh file has permissions -rw-rw-rw- root:root while the pod is running as user 'sonarqube' .

The currently available image in the docker hub sonarqube:7.1 has the same file layout but runs as 'root' and, thus can run.

Thank you.

Most helpful comment

I've another issue for 7.4-community image on kubernetes

mkdir: cannot create directory ‘/scripts’: Permission denied

All 9 comments

I've another issue for 7.4-community image on kubernetes

mkdir: cannot create directory ‘/scripts’: Permission denied

I've another issue for 7.4-community image on kubernetes, I update to the latest version and then I got this error when start sonar:

java.lang.IllegalStateException: Fail to load plugin Branch [branch]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:586)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185)
at org.sonar.server.platform.Platform.access$500(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/sonar/server/branch/BranchFeatureExtension
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at com.sonarsource.branch.BranchPlugin.define(Unknown Source)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.server.branch.BranchFeatureExtension
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
... 24 common frames omitted

@EPinci this happens because you are running the build on windows.
You could use linux to build
or add the command RUN chmod 777 $ SONARQUBE_HOME / bin / run.sh in your dockerfile (right after COPY command)
or use the sonarqube image in public registry.

_Saluti_

Indeed @moebius87 I was building it from windows.
I actually kind of bypassed the permission issue by changing the ENTRYPOINT to ["bash", "bin/run.sh"] (this does not require the script to have the executable bit set).
Also, another nasty thing was that git, on Windows, often replaces the LFs with CRLFs on clone and that breaks the script so I had to remove the extra CRs - but, in the end, got it running.

Clearly, now, I'm going to use the public image... ;)

Thank you, _ciao!_

I've another issue for 7.4-community image on kubernetes, I update to the latest version and then I got this error when start sonar:

java.lang.IllegalStateException: Fail to load plugin Branch [branch]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:586)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185)
at org.sonar.server.platform.Platform.access$500(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/sonar/server/branch/BranchFeatureExtension
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at com.sonarsource.branch.BranchPlugin.define(Unknown Source)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.server.branch.BranchFeatureExtension
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
... 24 common frames omitted

@danitochilin Did you manage to solve this? I cannot update to anything higher because of the gitlab plugin, but I also want the branch plugin.

I've another issue for 7.4-community image on kubernetes, I update to the latest version and then I got this error when start sonar:
java.lang.IllegalStateException: Fail to load plugin Branch [branch]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:82)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:586)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185)
at org.sonar.server.platform.Platform.access$500(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:119)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/sonar/server/branch/BranchFeatureExtension
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at com.sonarsource.branch.BranchPlugin.define(Unknown Source)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:72)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.server.branch.BranchFeatureExtension
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
... 24 common frames omitted

@danitochilin Did you manage to solve this? I cannot update to anything higher because of the gitlab plugin, but I also want the branch plugin.

I could not solve this, I had to restore a backup of the previous version 7.1

@danitochilin Looking at the sonarqube github repo, I see a big mess of tags. I cannot pinpoint the version 7.4, because there are only tags 7.0 and 7.5 onwards. But when you check the history of said class, it actually got added recently. Which is weird, because it should have been there even before 7.0. I guess in 7.6, maybe 7.5 it should work again.

@julienlancelot why did you do it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

longquan7 picture longquan7  Â·  7Comments

jasonrhaas picture jasonrhaas  Â·  9Comments

michal-duda-sonarsource picture michal-duda-sonarsource  Â·  6Comments

JoeyHoutenbos picture JoeyHoutenbos  Â·  3Comments

jcdalton2201 picture jcdalton2201  Â·  6Comments