ERROR: Language of file 'Dockerfile' can not be decided as the file matches patterns of both sonar.l

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    5.0.1.3006
  • how is SonarQube deployed: zip, Docker, Helm
    Docker
  • what are you trying to achieve
    Regular scan
  • what have you tried so far to achieve this
    Not much, cannot find solution
    Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I have code that has Java files and Dockerfile. Been using regular Sonarqube docker image to scan this code for a long time. However recently builds started to fail with the following error:

ERROR: Error during SonarScanner execution
ERROR: Language of file 'Dockerfile' can not be decided as the file matches patterns of both 
sonar.lang.patterns.docker : **/Dockerfile,**/*.dockerfile and
sonar.lang.patterns.dockerfile : Dockerfile
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I dont specify any of these currently. How can I solve this and why does it show up all of the sudden? I assume this means that there is some sort of conflict on which pattern to use. How can I set it to one of them? I tried

-Dsonar.lang.patterns.dockerfile="**/Dockerfile,**/*.dockerfile"

But it did not work.

Hey there.

What version of SonarQube are you using? You can find this in the footer of your instance.

10.3 is the version.

It seems that if I remove the first entry there, “Dockerfile” my scan jobs start working again.

Do you have any community-supported plugins installed on your instance? I’m thinking this one might be getting in the way: GitHub - cnescatlab/sonar-hadolint-plugin: sonar-hadolint-plugin is a SonarQube plugin used to integrate Hadolint results

Not sure, the instance is not hosted by me. Maybe I will be able to find out.