I'm trying to analyze source code using a docker image based on the official sonarscanner-cli
image using podman
(on a RHEL machine).
When I run
podman run --rm -v ".:/usr/src" sonarsource/sonar-scanner-cli:4.7
the output shows:
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
If I execute ls -l
before the podman
command, I can see the sonar-project.properties
file there.
If I check out the same directory on my windows machine and run
docker run -v "%CD%:/usr/src" sonarsource/sonar-scanner-cli:4.7
I get the following output as execpted
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /usr/src/sonar-project.properties
Why does podman not find the configuration file? Did I specify the "volume" wrong?
By executing
podman run --rm -v ".:/usr/src" sonarsource/sonar-scanner-cli:4.7 /bin/bash -c "ls -l"
I found out that the source of this was a permission problem:
total 0
ls: can't open '.': Permission denied
Adding the --privileged
switch to the call fixed the problem:
podman run --privileged --rm -v ".:/usr/src" sonarsource/sonar-scanner-cli:4.7