diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_index.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_index.md new file mode 100644 index 0000000000..b97f53d9f9 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_index.md @@ -0,0 +1,69 @@ +--- +title: Secure Multi-Architecture Containers with Trivy on Azure Cobalt 100 (Arm64) + +minutes_to_complete: 45 + +who_is_this_for: This learning path is designed for developers and DevOps engineers who want to integrate security scanning into CI/CD pipelines for multi-architecture container images. + +learning_objectives: + - Provision an Azure Arm64 virtual machine using Azure console, with Ubuntu Pro 24.04 LTS as the base image + - Build multi-architecture (amd64/arm64) container images for Azure Cobalt 100 + - Install and configure Trivy on Arm64 Ubuntu systems + - Scan container images for vulnerabilities locally and in CI + - Configure self-hosted GitHub Actions Arm runners + - Enforce security gates in CI/CD pipelines based on vulnerability severity + - Generate and analyze JSON reports for compliance and audit purposes + +prerequisites: + - A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6) + - Docker installed and basic knowledge of containerization + - Familiarity with CI/CD concepts + - Basic knowledge of Linux command-line operations + +author: Pareena Verma + +### Tags +skilllevels: Introductory +subjects: Containers and Virtualization +cloud_service_providers: Microsoft Azure + +armips: + - Neoverse + +tools_software_languages: + - Trivy + - Docker + - GitHub Actions + - YAML + +operatingsystems: + - Linux + +further_reading: + - resource: + title: Trivy Official Website + link: https://trivy.dev + type: website + - resource: + title: Trivy GitHub Repository + link: https://github.com/aquasecurity/trivy + type: website + - resource: + title: Docker Official Documentation + link: https://docs.docker.com/ + type: documentation + - resource: + title: GitHub Actions Documentation + link: https://docs.github.com/en/actions + type: documentation + - resource: + title: Microsoft Azure Cobalt 100 Overview + link: https://techcommunity.microsoft.com/blog/azurecompute/announcing-the-preview-of-new-azure-vms-based-on-the-azure-cobalt-100-processor/4146353 + type: documentation + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 +layout: "learningpathall" +learning_path_main_page: "yes" +--- diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_next-steps.md new file mode 100644 index 0000000000..c3db0de5a2 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/_next-steps.md @@ -0,0 +1,8 @@ +--- +# ================================================================================ +# FIXED, DO NOT MODIFY THIS FILE +# ================================================================================ +weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation. +title: "Next Steps" # Always the same, html page title. +layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing. +--- diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/background.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/background.md new file mode 100644 index 0000000000..c3f2051190 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/background.md @@ -0,0 +1,21 @@ +--- +title: "Overview" +weight: 2 + +### FIXED, DO NOT MODIFY +layout: "learningpathall" +--- + +## Cobalt 100 Arm-based processor + +Azure Cobalt 100 is Microsoft’s first-generation Arm-based processor, designed for cloud-native, scale-out Linux workloads. Based on Arm’s Neoverse-N2 architecture, it is a 64-bit CPU that delivers improved performance and energy efficiency. Running at 3.4 GHz, it provides a dedicated physical core for each vCPU, ensuring consistent and predictable performance. Typical workloads include web and application servers, data analytics, open-source databases, and caching systems. + +To learn more, see the Microsoft blog [Announcing the preview of new Azure virtual machines based on the Azure Cobalt 100 processor](https://techcommunity.microsoft.com/blog/azurecompute/announcing-the-preview-of-new-azure-vms-based-on-the-azure-cobalt-100-processor/4146353). + +## Trivy + +Trivy is an open-source vulnerability scanner designed to detect security issues in container images, filesystems, and infrastructure configurations. It is widely used in modern DevSecOps workflows to identify known vulnerabilities in operating system packages and application dependencies. + +You can use Trivy to perform fast and reliable security scans on container images built for multiple architectures, including Arm64. It helps teams shift security left by detecting vulnerabilities early in the development and CI/CD pipeline. + +Learn more at the [Trivy official website](https://trivy.dev/) and in the [Trivy documentation](https://trivy.dev/docs/). diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/arm64-runner.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/arm64-runner.png new file mode 100644 index 0000000000..dcc54bceeb Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/arm64-runner.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/final-vm.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/final-vm.png new file mode 100644 index 0000000000..5207abfb41 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/final-vm.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance.png new file mode 100644 index 0000000000..285cd764a5 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance1.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance1.png new file mode 100644 index 0000000000..b9d22c352d Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance1.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance4.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance4.png new file mode 100644 index 0000000000..2a0ff1e3b0 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/instance4.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/secrets.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/secrets.png new file mode 100644 index 0000000000..c3c98a6d97 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/secrets.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/security-scan.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/security-scan.png new file mode 100644 index 0000000000..d2c2b8330a Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/security-scan.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/trivy-multiarch.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/trivy-multiarch.png new file mode 100644 index 0000000000..aafbd08274 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/trivy-multiarch.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/ubuntu-pro.png b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/ubuntu-pro.png new file mode 100644 index 0000000000..d54bd75ca6 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/images/ubuntu-pro.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/instance.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/instance.md new file mode 100644 index 0000000000..e064907fc6 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/instance.md @@ -0,0 +1,66 @@ +--- +title: Create an Azure Cobalt 100 Arm64 virtual machine +weight: 3 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Prerequisites and setup + +There are several common ways to create an Arm-based Cobalt 100 virtual machine, and you can choose the method that best fits your workflow or requirements: + +- The Azure Portal +- The Azure CLI +- An infrastructure as code (IaC) tool + +In this section, you will launch the Azure Portal to create a virtual machine with the Arm-based Azure Cobalt 100 processor. + +This Learning Path focuses on general-purpose virtual machines in the Dpsv6 series. For more information, see the [Microsoft Azure guide for the Dpsv6 size series](https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/general-purpose/dpsv6-series). + +While the steps to create this instance are included here for convenience, you can also refer to the [Deploy a Cobalt 100 virtual machine on Azure Learning Path](/learning-paths/servers-and-cloud-computing/cobalt/). + +## Create an Arm-based Azure virtual machine + +Creating a virtual machine based on Azure Cobalt 100 is no different to creating any other virtual machine in Azure. Follow the steps below to create an Azure virtual machine: + +- Launch the Azure portal and navigate to **Virtual Machines**. +- Select **Create**, and select **Virtual Machine** from the drop-down list. +- Inside the **Basic** tab, fill in the instance details such as **Virtual machine name** and **Region**. +- Select the image for your virtual machine (for example, Ubuntu Pro 24.04 LTS) and select **Arm64** as the VM architecture. +- In the **Size** field, select **See all sizes** and select the D-Series v6 family of virtual machines. +- Select **D4ps_v6** from the list as shown in the diagram below: + +![Azure portal VM creation — Azure Cobalt 100 Arm64 virtual machine (D4ps_v6) alt-text#center](images/instance.png "Select the D-Series v6 family of virtual machines") + +- For **Authentication type**, select **SSH public key**. {{% notice Note %}} +Azure generates an SSH key pair for you and lets you save it for future use. This method is fast, secure, and easy for connecting to your virtual machine. +{{% /notice %}} +- Fill in the **Administrator username** for your VM. +- Select **Generate new key pair**, and select **RSA SSH Format** as the SSH Key Type. {{% notice Note %}} +RSA offers better security with keys longer than 3072 bits. +{{% /notice %}} +- Give your SSH key a key pair name. +- In the **Inbound port rules**, select **HTTP (80)** and **SSH (22)** as the inbound ports, as shown below: + +![Azure portal VM creation — Azure Cobalt 100 Arm64 virtual machine (D4ps_v6) alt-text#center](images/instance1.png "Allow inbound port rules") + +- Now select the **Review + Create** tab and review the configuration for your virtual machine. It should look like the following: + +![Azure portal VM creation — Azure Cobalt 100 Arm64 virtual machine (D4ps_v6) alt-text#center](images/ubuntu-pro.png "Review and create an Azure Cobalt 100 Arm64 VM") + +- When you are happy with your selection, select the **Create** button and then **Download Private key and Create Resource** button. + +![Azure portal VM creation — Azure Cobalt 100 Arm64 virtual machine (D4ps_v6) alt-text#center](images/instance4.png "Download private key and create resource") + +Your virtual machine should be ready and running in a few minutes. You can SSH into the virtual machine using the private key, along with the public IP details. + +![Azure portal VM creation — Azure Cobalt 100 Arm64 virtual machine (D4ps_v6) alt-text#center](images/final-vm.png "VM deployment confirmation in Azure portal") + +{{% notice Note %}} + +To learn more about Arm-based virtual machine in Azure, see “Getting Started with Microsoft Azure” in [Get started with Arm-based cloud instances](/learning-paths/servers-and-cloud-computing/csp/azure). + +{{% /notice %}} + +Your Azure Cobalt 100 Arm64 virtual machine is now ready. Continue to the next step to install and configure Trivy. diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-ci-integration.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-ci-integration.md new file mode 100644 index 0000000000..5611ea1218 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-ci-integration.md @@ -0,0 +1,314 @@ +--- +title: Enforce Container Security with Trivy in CI using Arm Runners on Azure Cobalt 100 +weight: 5 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Overview + +In this module, you will integrate Trivy into a CI pipeline using a self-hosted Arm64 GitHub Actions runner on Azure Cobalt 100. + +You will: + +- Set up an Arm-based GitHub runner +- Securely configure secrets +- Run Trivy scans automatically in CI +- Enforce security gates on vulnerable images +- Upload vulnerability reports for auditing + +This demonstrates a real-world DevSecOps workflow running natively on Arm infrastructure. + +You will move from local scanning to fully automated security enforcement in CI. + +## Prerequisites + +Ensure that you have: + +- Completed the local Trivy scanning module +- A GitHub repository +- An Azure Cobalt 100 Arm64 Ubuntu VM running +- A multi-architecture container image pushed to Docker Hub + +These components are required for building a secure CI pipeline. + + +## Create a New GitHub Repository + +Open in your browser: https://github.com/new + +**Fill in:** + +- Repository name: trivy-arm-ci-demo (or any name you prefer) +- Visibility: Public or Private +- Do NOT initialize with README (keep it empty) + +**Click:** + +- Create repository + +You now have an empty GitHub repository ready to receive your project files. + +## Initialize Git Repository Locally + +On your Azure Arm64 VM: + +```bash +cd ~/trivy-multiarch-demo +git init +``` + +Turns your local project folder into a Git repository. + +**Add and Commit Project Files:** + +```bash +git add . +git commit -m "Multi-arch nginx image for Trivy scan" +``` +Stage and save your Dockerfile and demo files into Git history. + +**Link Local Repo to GitHub:** + +```bash +git branch -M main +git remote add origin https://github.com//trivy-arm-ci-demo.git +``` + +You can connect your local repository to the remote GitHub repository. + +**Push Code to GitHub:** + +```bash +git push -u origin main +``` + +Uploads your project files to GitHub and sets the main branch for future pushes. + +## Setup GitHub Actions Arm Runner + +Navigate in GitHub: + +```text +Settings → Actions → Runners → Add Runner +``` + +Choose: + +Linux → ARM64 + +GitHub will display setup commands. + +This prepares GitHub to register a self-hosted Arm64 runner. + +![GitHub Actions Arm64 self-hosted runner connected alt-txt#center](images/arm64-runner.png "Arm64 GitHub Runner Status") + +## Create Runner Directory on VM + +Create a workspace for the GitHub runner software. +```bash +mkdir actions-runner +cd actions-runner +``` + +## Download Runner Package + +Use the download command provided by GitHub: + +```bash +curl -o actions-runner-linux-arm64.tar.gz -L https://github.com/actions/runner/releases/download/v2.331.0/actions-runner-linux-arm64-2.331.0.tar.gz +tar xzf actions-runner-linux-arm64.tar.gz +``` +Downloads and extracts the Arm64-compatible runner. + +**Configure Runner:** + +```bash +./config.sh --url https://github.com// --token +``` + +Registers the runner with your GitHub repository. + +**Start Runner:** + +```bash +./run.sh +``` + +```output +√ Connected to GitHub + +Current runner version: '2.331.0' +2026-01-28 05:30:41Z: Listening for Jobs +``` + +## Configure GitHub Secrets + +**In your GitHub repository:** + +```text +Settings → Secrets → Actions → New repository secret +``` +Add the following secrets: + +| Name | Value | +| ----------------- | ----------------------------------- | +| `DOCKER_USERNAME` | Your Docker Hub username | +| `DOCKER_PASSWORD` | Docker Hub password or access token | +| `IMAGE_NAME` | trivy-multiarch-nginx | +| `IMAGE_TAG` | latest | + +![GitHub Actions secrets configuration alt-txt#center](images/secrets.png "GitHub Secrets Configuration") + +## Create CI Workflow +Create Workflow Directory + +```bash +mkdir -p .github/workflows +``` +**Create file:** + +```bash +nano .github/workflows/trivy-scan.yml +``` + +Add: +Defines a CI pipeline that scans images on every push. + +```yaml +name: Trivy Scan on Arm Runner + +on: + push: + branches: [ "main" ] + +jobs: + security-scan: + runs-on: self-hosted + + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASS: ${{ secrets.DOCKER_PASSWORD }} + IMAGE_NAME: ${{ secrets.IMAGE_NAME }} + IMAGE_TAG: ${{ secrets.IMAGE_TAG }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + run: | + echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin + + - name: Pull multi-arch image + run: | + docker pull $DOCKER_USER/$IMAGE_NAME:$IMAGE_TAG + + - name: Run Trivy Scan + run: | + trivy image \ + --severity HIGH,CRITICAL \ + --exit-code 1 \ + $DOCKER_USER/$IMAGE_NAME:$IMAGE_TAG + + - name: Generate Trivy JSON Report + run: | + trivy image \ + --format json \ + -o trivy-report.json \ + $DOCKER_USER/$IMAGE_NAME:$IMAGE_TAG + + - name: Upload Report + uses: actions/upload-artifact@v4 + with: + name: trivy-report + path: trivy-report.json +``` + +## Trigger the CI Pipeline + +```bash +git add . +git commit -m "Add Trivy scan on Arm runner" +git push origin main +``` +Push triggers GitHub Actions automatically. + +## Verify CI Execution (Trivy Security Gate on Arm Runner) + +After pushing your code to GitHub, navigate to: + +```text +GitHub → Actions → Trivy Scan on Arm Runner +``` + +Select the latest workflow run. + +Expected Results: + +![GitHub Actions Trivy security scan workflow execution log alt-txt#center](images/security-scan.png "Trivy CI Security Scan Execution") + +You should observe the following: + +- The multi-architecture container image is pulled successfully on the Arm-based Azure Cobalt 100 runner +- Trivy performs a full vulnerability scan of the container image layers and installed packages +- The pipeline fails when HIGH or CRITICAL vulnerabilities are detected + +This failure is intentional and indicates that the security scan is functioning correctly. + +## How Trivy Works in This CI Pipeline + +Trivy is a container vulnerability scanner that: + +- Analyzes OS packages inside the image (like zlib, openssl, libc, etc.) +- Scans application dependencies (npm, pip, maven, etc. if present) +- Compares components against known CVE databases +- Assigns severity levels (LOW, MEDIUM, HIGH, CRITICAL) + +In this workflow: + +```bash +--severity HIGH,CRITICAL +--exit-code 1 +``` + +This means: + +- If Trivy finds any HIGH or CRITICAL vulnerability, it returns a non-zero exit code +- GitHub Actions marks the job as FAILED +- The image is blocked from moving forward in the pipeline + +This is known as a security gate. + +## Understanding the CI Scan Result +Is This Behavior Good or Bad? + +- This behavior is GOOD and expected in real-world CI/CD pipelines + +Modern DevSecOps practices integrate security tools like Trivy directly into Continuous Integration to automatically detect vulnerabilities. + +The pipeline is designed to: + +- Stop insecure container images early in the development lifecycle +-Prevent vulnerable software from reaching staging or production environments +- Enforce security and compliance policies automatically + +**What a Failing Pipeline Means** + +When the Trivy scan fails the job: + +- Trivy successfully detected HIGH or CRITICAL vulnerabilities in the container image +- The security gate blocked the insecure image +- The CI pipeline protected downstream environments + +**Why This Matters in Enterprise CI/CD** + +In enterprise environments, automated security enforcement is mandatory. + +- Failing fast on vulnerabilities ensures: +- Faster remediation +- Reduced security risk +- Strong compliance posture + +This behavior confirms that your Arm-based CI pipeline is working correctly. diff --git a/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-setup.md b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-setup.md new file mode 100644 index 0000000000..618df8adf2 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/trivy-on-gcpp/trivy-setup.md @@ -0,0 +1,261 @@ +--- +title: Build and Scan Multi-Architecture Container Images with Trivy on Azure Cobalt 100 (Arm64) +weight: 4 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Overview + +In this module, you will build a multi-architecture container image and perform vulnerability scanning using Trivy on an Azure Cobalt 100 Arm64 Ubuntu VM. + +You will: + +- Install Docker on Arm64 +- Build and push multi-arch container images +- Install Trivy on Arm64 +- Scan container images locally +- Generate vulnerability reports + +## Prerequisites + +Ensure: + +- Azure Cobalt 100 Arm64 Ubuntu VM +- Docker Hub account +- Internet connectivity + +Verify architecture: + +```bash +uname -m +``` + +## Install Docker on Arm64 VM +Update your system and install required tools for Docker installation. + +```bash +sudo apt update +sudo apt install -y ca-certificates curl gnupg lsb-release +``` + +**Add Docker GPG key:** + +Adds Docker’s official signing key so packages are trusted. + +```bash +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +``` + +**Add repository:** + +Register Docker’s package source for Arm64 Ubuntu. + +```bash +echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ +$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +``` + +**Install Docker:** + +Install Docker Engine and Buildx for multi-architecture builds. + +```bash +sudo apt update +sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin +``` + +**Enable Docker without sudo:** + +```bash +sudo usermod -aG docker $USER +newgrp docker +``` +Adds the user to the docker group and applies the new group permissions immediately, enabling non-root access to Docker. + +**Verify:** + +Confirm Docker is running natively on Arm64. + +```bash +docker info | grep Architecture +``` + +## Configure Docker Buildx for Multi-Architecture Builds + +**Create builder:** + +Create a special Docker builder capable of building images for multiple CPU architectures. + +```bash +docker buildx create --name multiarch-builder --use +``` + +**Initialize:** + +Prepare the builder to support multi-platform builds. + +```bash +docker buildx inspect --bootstrap +``` + +## Create Demo Application + +Creates a workspace for the demo container application. + +```bahs +mkdir trivy-multiarch-demo +cd trivy-multiarch-demo +``` + +## Create Dockerfile: + +```bash +nano Dockerfile +``` + +**Add:** + +Use NGINX as the base image and copy a custom webpage. + +```bash +FROM nginx:latest +COPY index.html /usr/share/nginx/html/index.html +``` + +## Create HTML file: + +```bash +nano index.html +``` + +**Add:** + +Create a simple webpage to confirm the container runs correctly. + +```bash +

Multi-Architecture NGINX on Azure Cobalt Arm64

+``` + +## Login to Docker Hub + +**Run the login command:** + +```bash +docker login +``` + +- Docker will display a one-time device code and a login URL: + +```text +https://login.docker.com/activate +``` + +**Steps to complete login:** + +- Open the displayed URL in your web browser +- Sign in to your Docker Hub account (or create one if you don’t have it) +- Enter the one-time confirmation code shown in the terminal +- Click Confirm / Activate + +Once authentication completes, the terminal will show: + +```output +WARNING! Your credentials are stored unencrypted in '/home/azureuser/.docker/config.json'. +Configure a credential helper to remove this warning. See +https://docs.docker.com/go/credential-store/ + +Login Succeeded +``` +This confirms your system is now authenticated with Docker Hub and ready to push or pull container images. + +## Build and Push Multi-Architecture Image + +```bash +docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -t /trivy-multiarch-nginx:latest \ + --push . +``` + +- Builds the container for both amd64 and arm64 +- Pushes the multi-arch image to Docker Hub + +This allows the same image to run on different CPU architectures. + +![Trivy scanning multi-architecture container image alt-txt#center](images/trivy-multiarch.png "Trivy Multi-Arch Image Scan") + +## Install Trivy on Arm64 + +**Download:** + +Download the Arm64-compatible Trivy scanner. + +```bash +wget https://github.com/aquasecurity/trivy/releases/download/v0.68.1/trivy_0.68.1_Linux-ARM64.deb +``` +{{% notice Note %}} +The [Arm Ecosystem Dashboard](https://developer.arm.com/ecosystem-dashboard/) recommends Trivy 0.29.0 or later for Arm platforms. +{{% /notice %}} + +**Install:** + +Install Trivy on your system. + +```bash +sudo dpkg -i trivy_0.68.1_Linux-ARM64.deb +``` + +**Verify:** + +```bash +trivy version +``` + +```output +Version: 0.68.1 +``` + +## Scan Image Locally + +**Run scan:** + +```bash +trivy image /trivy-multiarch-nginx:latest +``` +Trivy analyzes the container image and lists security vulnerabilities. + +## Generate JSON report + +```bash +trivy image \ + --format json \ + -o trivy-report.json \ + /trivy-multiarch-nginx:latest +``` + +Create a machine-readable vulnerability report for audits and CI pipelines. + +```output +2026-01-23T06:42:30Z INFO [vuln] Vulnerability scanning is enabled +2026-01-23T06:42:30Z INFO [secret] Secret scanning is enabled +2026-01-23T06:42:30Z INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning +2026-01-23T06:42:30Z INFO [secret] Please see https://trivy.dev/docs/v0.68/guide/scanner/secret#recommendation for faster secret detection +2026-01-23T06:42:32Z INFO Detected OS family="debian" version="12.5" +2026-01-23T06:42:32Z INFO [debian] Detecting vulnerabilities... os_version="12" pkg_num=149 +2026-01-23T06:42:33Z INFO Number of language-specific files num=0 +2026-01-23T06:42:33Z WARN Using severities from other vendors for some vulnerabilities. Read https://trivy.dev/docs/v0.68/guide/scanner/vulnerability#severity-selection for details. +``` + +## Outcome + +You have: + +- Installed Docker on Arm64 +- Built multi-architecture container images +- Pushed images to Docker Hub +- Installed Trivy on Azure Cobalt 100 +- Scanned images for vulnerabilities +- Generated security reports