Canarys | IT Services


Azure DevOps integration with Docker Image scanning – Trivy



In today’s software development landscape, ensuring the security of containerized applications is of paramount importance. Docker images, the building blocks of containerized deployments, need to be thoroughly examined for vulnerabilities before being deployed into production environments. Azure DevOps, a popular DevOps platform, offers robust integration capabilities to streamline and automate the development, testing, and deployment processes. By integrating Docker image scanning with Trivy into Azure DevOps pipelines, organizations can enhance their security posture and ensure the delivery of secure and reliable containerized applications.

This blog post explores the seamless integration of Trivy, an open-source vulnerability scanner for container images, with Azure DevOps. We will walk through the steps required to set up a CI/CD pipeline that incorporates Docker image scanning using Trivy. By following this integration approach, organizations can detect vulnerabilities within their container images early in the development process, enabling timely remediation and minimizing the risk of security breaches.

This blog post focuses on the significance of incorporating Trivy, an open-source vulnerability scanner, into Azure DevOps pipelines for Docker image scanning. We will explore the key reasons why Trivy is an essential tool in the container security toolkit and how its integration with Azure DevOps enhances the overall security posture of containerized applications.

  1. The Importance of Docker Image Scanning: Container images often consist of various layers, each containing libraries, frameworks, and other dependencies. These layers can introduce potential vulnerabilities that malicious actors can exploit. Performing thorough security scans on container images is crucial to identify and remediate vulnerabilities before deploying them to production environments. Docker image scanning helps safeguard applications and prevents security breaches caused by known vulnerabilities.
  1. Identifying Security Risks with Trivy: Trivy is specifically designed for container image scanning, making it an ideal choice for detecting vulnerabilities and security risks. Trivy leverages an extensive vulnerability database and performs comprehensive checks against known Common Vulnerabilities and Exposures (CVEs). It scans not only the base image but also its dependencies, providing a holistic view of the overall security status of the containerized application.
  1. Early Detection and Remediation: By integrating Trivy into Azure DevOps pipelines, organizations can detect vulnerabilities early in the software development lifecycle. Trivy’s automated scanning capabilities enable continuous monitoring of container images throughout the CI/CD pipeline, ensuring that security issues are identified and addressed promptly. Early detection allows developers to remediate vulnerabilities in a timely manner, reducing the risk of deploying insecure images into production.
  1. Compliance and Risk Mitigation: Many industries have regulatory requirements and compliance standards that demand robust security practices. Integrating Trivy into Azure DevOps pipelines helps organizations meet compliance requirements by proactively scanning container images and demonstrating due diligence in addressing vulnerabilities. It mitigates the risk of potential security incidents, data breaches, and associated legal and financial consequences.
  1. Streamlining DevOps Workflow: Integrating Trivy with Azure DevOps provides a streamlined and automated approach to Docker image scanning. By embedding Trivy scans within the CI/CD pipeline, developers and DevOps teams can seamlessly incorporate security checks into their existing workflow. This integration reduces manual effort and ensures consistent and repeatable security assessments across different environments.

Scope of the blog:

  1. Build the Docker image
  2. Scan with Trivy And generate the report in the Azure Devops

Required Pre-requisites:

  1. Source Code Containing the Dockerfile in the Azure DevOps.
  2. Trivy (Code scanning tool used in this blog)


  1. Source Code with the Dockerfile init.

  1. Create the Azure Build Pipeline in the YML by defining the trigger, variables and agent pool.

  1. Add the task to Build the Dockerfile and link the ACR Credentials through Service Connection.

  1. Add the task to Install the Trivy Tool and Run the Trivy Scan.

  1. Once this Configuration is done it will generate the report in the logs:

  1. It will generate the report in the Azure DevOps Analytics Section:


Integrating Docker image scanning using Trivy into Azure DevOps pipelines empowers organizations to enhance the security and reliability of their containerized applications. By automating vulnerability detection, developers and DevOps teams can proactively address security issues early in the development process, reduce the risk of exposing vulnerabilities in production environments, and ensure the delivery of secure software. This blog post aims to provide a comprehensive guide for organizations looking to implement Docker image scanning within their Azure DevOps pipelines, ultimately fostering a secure and robust DevOps culture.

Leave a Reply

Your email address will not be published. Required fields are marked *

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.