Child pages
  • Anchore Container Image Scanner Plugin

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add anchore build options image


We will add a single line to create the anchore_images file that is read by the Anchore Plugin

Note: Multiple lines can be added if the build produces more than a single container image.


Code Block
TAG=$(date "+%H%M%S%d%m%Y")
docker build -t $IMAGENAME:$TAG .
docker push $IMAGENAME:$TAG

# Line added to create anchore_images file
echo "$IMAGENAME:$TAG ${WORKSPACE}/Dockerfile " > anchore_images

After the image has been built and pushed to the staging registry the Anchore Scanner should be called. 

Dropdown Add build step and select the Anchore Container Image Scanner

A new build step labeled Anchore Build Options will appear in your job.

<Insert image here>Image Added

Image list fileName of the file, present in workspace that contains the image name and optionally Dockerfile location
Fail build on policy check STOP resultIf the Anchore Engine policy evaluate returns a fail (STOP) then the Jenkins job should be failed. If this is not selected then a failed policy evaluation will allow the build to continue.
Fail build on critical plugin errorIf selected and the Anchore Plugin experiences a critical error the the build will be failed. This is typically used to ensure that a fault with the Anchore Engine (eg. service not available) does not permit a failing image to be promoted to production.
AnchoreEngine operation retriesHow long in seconds the Anchore Plugin waits until timing out image analysis.
The Plugin will continue operation once the image has been analyzed but will time out if this period is exceeded.

The Anchore Plugin creates an Anchore Report directory that includes a JSON file including the results of the policy evaluation.

The Plugin renders this in the Jenkins UI showing the status of the build (GO = Pass, STOP = Fail, WARN=Warning)

Clicking on the Anchore Report link will display a graphical policy reporting showing the summary information and a detailed list of policy checks and results.


Following is a sample code snippet for using Anchore Plugin in a pipeline script. For more options refer to Pipeline Syntax and try the Snippet Generator

Code Block
node {
  def imageLine = 'debian:latest'
  writeFile file: 'anchore_images', text: imageLine
  anchore name: 'anchore_images'