Public | Automated Build

Last pushed: 4 months ago
Short Description
Small Container with SonarQube Scanner 3.0.3
Full Description

docker-sonar-scanner Overview

A quick Sonar scanner (command line) container.

This Dockerfile sets up the command line scanner vs. any other existing analysis
method. For other analysis methods, see the bottom of this page:

For details on running the command line scanner:

and for a list of command-line options:


You must have a Sonar Qube server running. I used the Docker image available here:


To build this scanner image, just issue a standard Docker build command:

docker build -t mitch/sonarscanner .


Make sure you have a Sonar Qube server running. You can use the official build here:

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube:5.2

or use my slightly modified version with a command to update the server time to a specified
time zone (set to CST by default - if that's yours just omit the -e parameter):

docker run -d --name sonarqube -e "TZ=America/Chicago" -p 9000:9000 -p 9092:9092 sonarqube:5.2

After your server is running, run the following command from the command line to stasrt the scanner.

docker run -ti -v $(pwd):/root/src --link sonarqube mitch/sonarscanner 

Replace "$(pwd)" with the absolute path of the top-level source directly you're
interested in if you're not running the docker image from the top level project

The supplied file points to as the
Qube server. If you need to change that, either run the Docker container with
the bash command and run the command yourself, or just modify the command when
you run the container:

docker run -ti -v $(pwd):/root/src mitch/sonarscanner sonar-runner -Dsonar.projectBaseDir=./src

Server image

I've also included Dockerfile.server, which uses the sonarqube:latest image as a
basis and basically puts in the mechanism to update the server time to a user-defined
time zone vs. the default (correct time reporting for analyzer runs).

Docker Hub of this build available here:

You can modify the Dockerfile to update the timezone, or just pass in the environment variable on-demand:

docker run -d --name sonarqube -e "TZ=America/Chicago" -p 9000:9000 -p 9092:9092 sonarqube
Docker Pull Command
Source Repository

Comments (0)