C# SonarScanner .NET Core version Permission denied error in docker

scanner
docker
dotnet
(Rolf Wessels) #1

Version information

  • Dotnet-sonarscanner version 4.6.0
  • MSBuild 4.6
  • docker base images microsoft/dotnet:2.1-sdk-alpine3.7

Output
When running the scanner in a docker container the begin part works as expected

run @/root/.dotnet/tools/dotnet-sonarscanner begin ....

SonarScanner for MSBuild 4.6
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
14:49:42.233  Updating build integration targets...
14:49:42.251  Fetching analysis configuration settings...
14:49:45.539  Provisioning analyzer assemblies for cs...
14:49:45.54  Installing required Roslyn analyzers...
14:49:49.716  Provisioning analyzer assemblies for vbnet...
14:49:49.716  Installing required Roslyn analyzers...
14:49:49.741  Pre-processing succeeded.

Then once the project is build and I try to run the end command I get

run @/root/.dotnet/tools/dotnet-sonarscanner end

SonarScanner for MSBuild 4.6
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
WARNING: File '/root/.nuget/packages/nunit3testadapter/3.11.2/build/netcoreapp1.0/NUnit3.TestAdapter.dll' is not located under the root directory '/root/repo' and will not be analyzed.
WARNING: File '/root/.nuget/packages/nunit3testadapter/3.11.2/build/netcoreapp1.0/NUnit3.TestAdapter.pdb' is not located under the root directory '/root/repo' and will not be analyzed.
WARNING: File '/root/.nuget/packages/nunit3testadapter/3.11.2/build/netcoreapp1.0/nunit.engine.netstandard.dll' is not located under the root directory '/root/repo' and will not be analyzed.
Calling the SonarQube Scanner...
/root/.dotnet/tools/.store/dotnet-sonarscanner/4.6.0/dotnet-sonarscanner/4.6.0/tools/netcoreapp2.1/any/sonar-scanner-3.3.0.1492/bin/sonar-scanner: exec: line 66: : Permission denied
The SonarQube Scanner did not complete successfully
14:50:33.596  Post-processing failed. Exit code: 1

*I have tried the following *

Look forward to resolving this issue.

(Rolf Wessels) #2

Sorry, bit more searching and I found the issue.

Add the following to the docker image.

RUN apk add --no-cache --update \
    openjdk8-jre\
    nss
(Julien Lancelot) #3

Thanks for the update and for telling how you’ve fixed your issue !