Forrest logo
back to the trivy tool

trivy:tldr:42990

trivy: Generate output with a SARIF template.
$ trivy image --format ${template} --template ${"@sarif-tpl"} -o ${path-to-report-sarif} ${image:tag}
try on your machine

The command you provided is using the "trivy" tool to scan a Docker image for vulnerabilities. Below is the breakdown of the command:

  • "trivy image" instructs the tool to perform a vulnerability scan on a Docker image.
  • "--format ${template}" specifies the format of the output generated by the tool. You need to replace "${template}" with the desired output format, such as "json", "table", etc.
  • "--template ${"@sarif-tpl"}" specifies the template to be used for the output. The template "${"@sarif-tpl"}" refers to a specific predefined SARIF (Static Analysis Results Interchange Format) template. SARIF is a standardized format for reporting static analysis or vulnerability scan results.
  • "-o ${path-to-report-sarif}" specifies the path where the generated report in SARIF format will be stored. You need to replace "${path-to-report-sarif}" with the desired path and filename for the report.
  • "${image:tag}" represents the Docker image and tag to be scanned. You need to replace "${image:tag}" with the actual image name and tag you want to scan.

Overall, this command runs the trivy tool, defines the output format as SARIF, specifies a SARIF template, and scans a particular Docker image to generate a vulnerability report in SARIF format at a specified location.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the trivy tool