Running in docker of GitLab CI results in Operation not permitted (from computeCanonicalPath)


The error is observed in a docker containter while running as a CI job in GitLab:
Scanner configuration file: /opt/sonar-scanner/conf/
Project root configuration file: /builds//
Analyzing on SonarQube server Developer
Java 11.0.12 Oracle Corporation (64-bit)
Linux 4.9.0-14-amd64 amd64


  • CFamily Code Quality and Security (cpp)
ERROR: Exception in thread pool-3-thread-1
java.lang.IllegalStateException: Operation not permitted
	at com.sonar.cpp.plugin.CFamilySensor.computeCanonicalPath(
	at java.base/java.util.HashMap.computeIfAbsent(
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/
Caused by: Operation not permitted
	at java.base/ Method)
	at java.base/
	at java.base/
	at com.sonar.cpp.plugin.CFamilySensor.computeCanonicalPath(
	... 9 common frames omitted

The error occurs when analyzing CPP code from a QT application on linux (inside docker container). Analysis works perfectly when run on a regular linux with the same packages installed.

UPDATE: I updated SonarQube to the latest LTS version (8.9.2) but the issue still persists.

UPDATE (2): Also changing to the docker container of sonarsource (sonarsource/sonar-scanner-cli:latest) gives the same exception:

12:04:05.097 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Operation not permitted
	at com.sonar.cpp.plugin.CFamilySensor.computeCanonicalPath(
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.main(
Caused by: Operation not permitted
	at java.base/ Method)
	at java.base/ Source)
	at java.base/ Source)
	at com.sonar.cpp.plugin.CFamilySensor.computeCanonicalPath(
	... 33 more

Hi @farmann ,

a couple of notes to help you understanding what could be wrong:

  • build and analysis should be run within the same environment, which means not in different containers, ideally right after build command
  • given the error Operation not permitted there could be different possibilities: process doesn’t have access to the file, the file is in a network drive

Thank you for your reply @mpaladin .

Unfortunately it is not a build/analysis issue (and I was able to have successful build/analysis when running the docker containers locally in interactive mode). This also excludes the second suggestion (permission error) as it worked in interactive mode.

BUT in the process of researching other options/causes I discovered that there are general issues with alpine linux and UnixFileSystem.canonicalize0 JNI call.

In the latest Dockerfile of the sonar-scanner-cli-docker image the following base-image is used: adoptopenjdk/openjdk11:alpine-jre

The solution for me was to build the image from scratch and swapping the base-image for a debian based one: adoptopenjdk/openjdk11:debian-jre
(I had to adapt the dependency install - “apk” commands replaced with “apt”, different package names.)

Now everything works as it is supposed to. I hope this will also help others :slight_smile:

Hi @farmann ,

thank you for coming back.

For C and C++ analysis we don’t recommend to use the sonar-scanner-cli-docker, we recommend to use the standalone sonar-scanner-cli.


NB: These Docker images are not compatible with C/C#/C++/Objective-C projects.

For C and C++ it is easier to download sonar-scanner-cli in your already existing build environment.

Hi @mpaladin,
Thanks for that clarification. As I am using it in a GitLab pipeline, this was the simplest way.
I had tried to install the sonar-scanner-cli in the build container, but of course now in hindsight that container was also based on alpine linux.
Is there a particular reason why C/C++ projects are not supported (recommended) by the docker image?

Hi @farmann ,

Yes, during the analysis of C and C++ project we have the strict requirement of running in the same build environment in order to access the same system headers and third-party headers used during build. When running sonar-scanner-cli-docker those header files are not available on the machine leading to a poor quality analysis.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.