Sonarscan base image

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

We are using this base image for code quality scan - sonarsource/sonar-scanner-cli:4.6
As part of this image, all the required plugins are getting downloaded which is taking around 6-7 minutes on an average. Is there any other way that we can have the plugins as part of the base image itself which will reduce the download plugins time. Please help me on this.


You can cache the files as described in the documentation, please read the topic “advanced docker configuration” > “caching scanner files”:

Thanks Felipe, may I know what does ${YOUR_REPO} refer to

It’s the directory containing the files to be analyzed, but I think you’re already setting this parameter otherwise SonarScanner would analyze an empty directory.

Just add the -v YOUR_CACHE_DIR:/opt/sonar-scanner/.sonar/cache to your docker run command, replacing YOUR_CACHE_DIR by a real directory on your system.

Thanks Felipe, I will try this and update here

Hi Felipe, it worked. Thanks. Also, I have created custom image from base image by downloading plugins to host & copying the plugins to /opt/sonar-scanner/.sonar/cache in dockerfile. Which is now reduces the time from 7 minutes to 1 minute.