Container vulnerabilities don't wait for your next deployment. They can emerge at anypoint, including when you build an image or while containers run in production.GitLab addresses this reality with multiple container scanning approaches, each designedfor 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.Why container scanning mattersSecurity vulnerabilities in container images create risk throughout your applicationlifecycle. Base images, OS packages, and application dependencies can all harborvulnerabilities that attackers actively exploit. Container scanning detects these risksearly, 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 containerizedapplications rely on.The five types of GitLab Container ScanningGitLab offers five distinct container scanning approaches, each serving a specificpurpose in your security strategy.1. Pipeline-based Container ScanningWhat it does: Scans container images during your CI/CD pipeline execution,catching vulnerabilities before deploymentBest for: Shift-left security, blocking vulnerable images from reaching productionTier availability: Free, Premium, and Ultimate (with enhanced features in Ultimate)DocumentationGitLab uses the Trivy security scanner to analyze container images forknown vulnerabilities. When your pipeline runs, the scanner examines your imagesand generates a detailed report.How to enable pipeline-based Container ScanningOption A: Preconfigured merge requestNavigate to Secure > Security configuration in your project.Find the "Container Scanning" row.Select Configure with a merge request.This automatically creates a merge request with the necessary configuration.Option B: Manual configurationAdd the following to your .gitlab-ci.yml:include: - template: Jobs/Container-Scanning.gitlab-ci.ymlCommon configurationsScan 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.ymlcontainer_scanning: variables: CS_IMAGE: myregistry.com/myapp:latestFilter by severity threshold:To only find vulnerabilities with a certain severity criteria, overwrite theCS_SEVERITY_THRESHOLD variable in the container_scanning job. In the examplebelow, only vulnerabilities with a severity of High or greater will be displayed.include: - template: Jobs/Container-Scanning.gitlab-ci.ymlcontainer_scanning: variables: CS_SEVERITY_THRESHOLD: "HIGH"Viewing vulnerabilities in a merge requestViewing Container Scanning vulnerabilities directly within merge requests makes securityreviews seamless and efficient. Once Container Scanning is configured in your CI/CDpipeline, GitLab automatically display detected vulnerabilities in the merge request'sSecurity widget.Navigate to any merge request and scroll to the "Security Scanning" section to see a summary ofnewly introduced and existing vulnerabilities found in your container images.Click on a Vulnerability to access detailed information about the finding, including severity level,affected packages, and available remediation guidance.This visibility enables developers and security teams to catch and address containervulnerabilities before they reach production, making security an integral part of yourcode review process rather than a separate gate.Viewing vulnerabilities in Vulnerability ReportBeyond merge request reviews, GitLab provides a centralizedVulnerability Report that gives security teams comprehensive visibility across all Container Scanning findings in your project.Access this report by navigating to Security & Compliance > Vulnerability Report in yourproject sidebar.Here you'll find an aggregated view of all container vulnerabilities detected across your branches, with powerful filtering options to sort by severity, status, scanner type, or specific container images.You can click on a vulnerabilty to access its Vulnerablity page.Vulnerability Detailsshows exactly which container images and layers are impacted, making it easier to trace thevulnerability back to its source. You can assign vulnerabilities to team members, changetheir 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.View the Dependency ListGitLab's Dependency Listprovides a comprehensive software bill of materials (SBOM) that catalogs every component withinyour container images, giving you complete transparency into your software supply chain.Navigate to Security & Compliance > Dependency List to access an inventory of all packages,libraries, and dependencies detected by Container Scanning across your project.This view is invaluable for understanding what's actually running inside your containers, from base OSpackages to application-level dependencies.You can filter the list by package manager, license type, or vulnerability status to quicklyidentify which components pose security risks or compliance concerns. Each dependency entryshows associated vulnerabilities, allowing you to understand security issues in the contextof your actual software components rather than as isolated findings.2. Container Scanning for RegistryWhat it does: Automatically scans images pushed to your GitLab Container Registrywith the latest tagBest for: Continuous monitoring of registry images without manual pipeline triggersTier availability: Ultimate onlyDocumentationWhen you push a container image tagged latest, GitLab's security policy botautomatically triggers a scan against the default branch. Unlike pipeline-basedscanning, this approach works with Continuous Vulnerability Scanning to monitorfor newly published advisories.How to enable Container Scanning for RegistryNavigate to Secure > Security configuration.Scroll to the Container Scanning For Registry section.Toggle the feature on.PrerequisitesMaintainer role or higher in the projectProject must not be empty (requires at least one commit on the default branch)Container Registry notifications must be configuredPackage Metadata Database must be configured (enabled by default on GitLab.com)Vulnerabilities appear under the Container Registry vulnerabilities tab in yourVulnerability Report.3. Multi-Container ScanningWhat it does: Scans multiple container images in parallel within a single pipelineBest for: Microservices architectures and projects with multiple container imagesTier availability: Free, Premium, and Ultimate (currently in Beta)DocumentationMulti-Container Scanning uses dynamic child pipelines to run scans concurrently, significantly reducing overall pipeline execution time when you need to scan multiple images.How to enable Multi-Container scanningCreate a .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"Include the template in your .gitlab-ci.yml:include: - template: Jobs/Multi-Container-Scanning.latest.gitlab-ci.ymlAdvanced configurationScan images from private registries:auths: registry.gitlab.com: username: ${CI_REGISTRY_USER} password: ${CI_REGISTRY_PASSWORD}scanTargets: - name: registry.gitlab.com/private/image tag: latestInclude license information:includeLicenses: truescanTargets: - name: postgres tag: "15-alpine"4. Continuous Vulnerability ScanningWhat it does: Automatically creates vulnerabilities when new security advisories are published, no pipeline requiredBest for: Proactive security monitoring between deploymentsTier availability: Ultimate onlyDocumentationTraditional scanning only catches vulnerabilities at scan time. But what happenswhen a new CVE is published tomorrow for a package you scanned yesterday? ContinuousVulnerability Scanning solves this by monitoring the GitLab Advisory Database andautomatically creating vulnerability records when new advisories affect your components.How it worksYour Container Scanning or Dependency Scanning job generates a CycloneDX SBOM.GitLab registers your project's components from this SBOM.When new advisories are published, GitLab checks if your components are affected.Vulnerabilities are automatically created in your vulnerability report.Key considerationsScans run via background jobs (Sidekiq), not CI pipelines.Only advisories published within the last 14 days are considered for new component detection.Vulnerabilities use "GitLab SBoM Vulnerability Scanner" as the scanner name.To mark vulnerabilities as resolved, you still need to run a pipeline-based scan.5. Operational Container ScanningWhat it does: Scans running containers in your Kubernetes cluster on ascheduled cadenceBest for: Post-deployment security monitoring and runtime vulnerability detectionTier availability: Ultimate onlyDocumentationOperational Container Scanning bridges the gap between build-time security andruntime security. Using the GitLab Agent for Kubernetes, it scans containersactually running in your clusters—catching vulnerabilities that emerge afterdeployment.How to enable Operational Container ScanningIf 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 - stagingYou can also create a scan execution policy that enforces scanning on a schedule by the GitLab Kubernetes Agent.Viewing resultsNavigate to Operate > Kubernetes clusters.Select the Agent tab, and choose your agent.Then select the Security tab to view cluster vulnerabilities.Results also appear under the Operational Vulnerabilities tab in the Vulnerability Report.Enhancing posture with GitLab Security PoliciesGitLab 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 and pipeline policiesScan 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.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.Merge request approval policiesMerge 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.Choosing the right approachScanning TypeWhen to UseKey BenefitPipeline-basedEvery buildShift-left security, blocks vulnerable buildsRegistry scanningContinuous monitoringCatches new CVEs in stored imagesMulti-containerMicroservicesParallel scanning, faster pipelinesContinuous vulnerabilityBetween deploymentsProactive advisory monitoringOperationalProduction monitoringRuntime vulnerability detectionFor comprehensive security, consider combining multiple approaches. Usepipeline-based scanning to catch issues during development, containerscanning for registry for continuous monitoring, and operational scanningfor production visibility.Get started todayThe fastest path to container security is enabling pipeline-based scanning:Navigate to your project's Secure > Security configuration.Click Configure with a merge request for Container Scanning.Merge the resulting merge request.Your next pipeline will include vulnerability scanning.From there, layer in additional scanning types based on your security requirementsand GitLab tier.Container security isn't a one-time activity, it's an ongoing process.With GitLab's comprehensive container scanning capabilities, you can detectvulnerabilities 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.html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}