Published on: March 5, 2026
11 min read
Explore GitLab's various container scanning methods and learn how to secure containers at every lifecycle stage.

Container vulnerabilities don't wait for your next deployment. They can emerge at any point, including when you build an image or while containers run in production. GitLab addresses this reality with multiple container scanning approaches, each designed for different stages of your container lifecycle.
In this guide, we'll explore the different types of container scanning GitLab offers, how to enable each one, and common configurations to get you started.
Security vulnerabilities in container images create risk throughout your application lifecycle. Base images, OS packages, and application dependencies can all harbor vulnerabilities that attackers actively exploit. Container scanning detects these risks early, before they reach production, and provides remediation paths when available.
Container scanning is a critical component of Software Composition Analysis (SCA), helping you understand and secure the external dependencies your containerized applications rely on.
GitLab offers five distinct container scanning approaches, each serving a specific purpose in your security strategy.
GitLab uses the Trivy security scanner to analyze container images for known vulnerabilities. When your pipeline runs, the scanner examines your images and generates a detailed report.
Option A: Preconfigured merge request
Option B: Manual configuration
.gitlab-ci.yml: include:
- template: Jobs/Container-Scanning.gitlab-ci.yml
Scan a specific image:
To scan a specific image, overwrite the CS_IMAGE variable in the container_scanning job.
include:
- template: Jobs/Container-Scanning.gitlab-ci.yml
container_scanning:
variables:
CS_IMAGE: myregistry.com/myapp:latest
Filter by severity threshold:
To only find vulnerabilities with a certain severity criteria, overwrite the
CS_SEVERITY_THRESHOLD variable in the container_scanning job. In the example
below, only vulnerabilities with a severity of High or greater will be displayed.
include:
- template: Jobs/Container-Scanning.gitlab-ci.yml
container_scanning:
variables:
CS_SEVERITY_THRESHOLD: "HIGH"
Viewing Container Scanning vulnerabilities directly within merge requests makes security reviews seamless and efficient. Once Container Scanning is configured in your CI/CD pipeline, GitLab automatically display detected vulnerabilities in the merge request's Security widget.
Container Scanning vulnerabilities displayed in MR

Container Scanning vulnerability details in MR
This visibility enables developers and security teams to catch and address container vulnerabilities before they reach production, making security an integral part of your code review process rather than a separate gate.
Beyond merge request reviews, GitLab provides a centralized Vulnerability Report that gives security teams comprehensive visibility across all Container Scanning findings in your project.
Vulnerability Report sorted by Container Scanning


Vunerability Details for a Container Scanning vulnerability
Vulnerability Details shows exactly which container images and layers are impacted, making it easier to trace the vulnerability back to its source. You can assign vulnerabilities to team members, change their status (detected, confirmed, resolved, dismissed), add comments for collaboration, and link related issues for tracking remediation work.
This workflow transforms vulnerability management from a spreadsheet exercise into an integrated part of your development process, ensuring that container security findings are tracked, prioritized, and resolved systematically.
GitLab's Dependency List provides a comprehensive software bill of materials (SBOM) that catalogs every component within your container images, giving you complete transparency into your software supply chain.
GitLab Dependency List (SBOM)
You can filter the list by package manager, license type, or vulnerability status to quickly identify which components pose security risks or compliance concerns. Each dependency entry shows associated vulnerabilities, allowing you to understand security issues in the context of your actual software components rather than as isolated findings.
latest tagWhen you push a container image tagged latest, GitLab's security policy bot
automatically triggers a scan against the default branch. Unlike pipeline-based
scanning, this approach works with Continuous Vulnerability Scanning to monitor
for newly published advisories.
Toggle for Container Scanning for Registry
Vulnerabilities appear under the Container Registry vulnerabilities tab in your Vulnerability Report.
Multi-Container Scanning uses dynamic child pipelines to run scans concurrently, significantly reducing overall pipeline execution time when you need to scan multiple images.
.gitlab-multi-image.yml file in your repository root: scanTargets:
- name: alpine
tag: "3.19"
- name: python
tag: "3.9-slim"
- name: nginx
tag: "1.25"
.gitlab-ci.yml: include:
- template: Jobs/Multi-Container-Scanning.latest.gitlab-ci.yml
Scan images from private registries:
auths:
registry.gitlab.com:
username: ${CI_REGISTRY_USER}
password: ${CI_REGISTRY_PASSWORD}
scanTargets:
- name: registry.gitlab.com/private/image
tag: latest
Include license information:
includeLicenses: true
scanTargets:
- name: postgres
tag: "15-alpine"
Traditional scanning only catches vulnerabilities at scan time. But what happens when a new CVE is published tomorrow for a package you scanned yesterday? Continuous Vulnerability Scanning solves this by monitoring the GitLab Advisory Database and automatically creating vulnerability records when new advisories affect your components.
Operational Container Scanning bridges the gap between build-time security and runtime security. Using the GitLab Agent for Kubernetes, it scans containers actually running in your clusters—catching vulnerabilities that emerge after deployment.
If you are using the GitLab Kubernetes Agent, you can add the following to your agent configuration file:
container_scanning:
cadence: '0 0 * * *' # Daily at midnight
vulnerability_report:
namespaces:
include:
- production
- staging
You can also create a scan execution policy that enforces scanning on a schedule by the GitLab Kubernetes Agent.
Scan execution policy conditions for Operational Container Scanning
GitLab Security Policies enable you to enforce consistent security standards across your container workflows through automated, policy-driven controls. These policies shift security left by embedding requirements directly into your development pipeline, ensuring vulnerabilities are caught and addressed before code reaches production.
Scan execution policies automate when and how Container Scanning runs across your projects. Define policies that trigger container scans on every merge request, schedule recurring scans of your main branch, and more. These policies ensure comprehensive coverage without relying on developers to manually configure scanning in each project's CI/CD pipeline.
You can specify which scanner versions to use and configure scanning parameters centrally, maintaining consistency across your organization while adapting to new container security threats.
Scan execution policy configuration
Pipeline execution policies provide flexible controls for injecting (or overriding) custom jobs into a pipeline based on your compliance needs.
Use these policies to automatically inject Container Scanning jobs into your pipeline, fail builds when container vulnerabilities exceed your risk tolerance, trigger additional security checks for specific branches or tags, or enforce compliance requirements for container images destined for production environments. Pipeline execution policies act as automated guardrails, ensuring your security standards are consistently applied across all container deployments without manual intervention.
Pipeline execution policy actions
Merge request approval policies enforce security gates by requiring designated approvers to review and sign off on merge requests containing container vulnerabilities.
Configure policies that block merge when critical or high-severity vulnerabilities are detected, or require security team approval for any merge request introducing new container findings. These policies prevent vulnerable container images from advancing through your pipeline while maintaining development velocity for low-risk changes.
Merge request approval policy performing block in MR
| Scanning Type | When to Use | Key Benefit |
|---|---|---|
| Pipeline-based | Every build | Shift-left security, blocks vulnerable builds |
| Registry scanning | Continuous monitoring | Catches new CVEs in stored images |
| Multi-container | Microservices | Parallel scanning, faster pipelines |
| Continuous vulnerability | Between deployments | Proactive advisory monitoring |
| Operational | Production monitoring | Runtime vulnerability detection |
For comprehensive security, consider combining multiple approaches. Use pipeline-based scanning to catch issues during development, container scanning for registry for continuous monitoring, and operational scanning for production visibility.
The fastest path to container security is enabling pipeline-based scanning:
From there, layer in additional scanning types based on your security requirements and GitLab tier.
Container security isn't a one-time activity, it's an ongoing process. With GitLab's comprehensive container scanning capabilities, you can detect vulnerabilities at every stage of your container lifecycle, from build to runtime.
For more information on how GitLab can help enhance your security posture, visit the GitLab Security and Governance Solutions Page.
Enjoyed reading this blog post or have questions or feedback? Share your thoughts by creating a new topic in the GitLab community forum.
Share your feedback