How to scan Docker containers for vulnerabilities using Trivy

How to scan Docker containers for vulnerabilities using Trivy

  1. Home
  2. Blogs
  3. How to scan Docker containers for vulnerabilities using Trivy

Evaluation of open source infrastructure, container image testing, configuration file adjustment — these are just a small part of the functionality provided by the Trivy Docker vulnerability scanner.

For reference: this utility is an effective tool based on Aqua Security (open source code), whose main practical purpose is to monitor risks and misconfigurations related to the operating system. A key feature of Trivy is its ability to analyze Kubernetes and scan code repositories in Git.

Installing the Trivy vulnerability scanner

The simplicity and convenience of the installation process make it easy to integrate the utility into DevSecOps (CI/CD pipeline). To do so, it’s enough to add a binary-based file to your project.

After installing the Trivy package, the user gains access to an extensive vulnerability and error database, allowing for rapid and effective scanning of critical OS areas. The utility supports most known programming languages, hidden packages, OS archives, and provides progressive updates — enabling security professionals to monitor vulnerabilities and critical errors efficiently and in a timely manner.

Important: to avoid infecting a portable or personal computer with malicious code (viruses), it is strongly recommended to install the scanner only from the official Ubuntu repository.

Once the package is installed and updated to the latest version, the user can begin vulnerability scanning.

Git repositories: scanning file features

The utility allows users to search for critical errors and vulnerabilities across different repositories.

For example, if Git is selected as the main storage, it's possible to scan a Git file directly (without downloading the entire package).

Docker containers: vulnerability monitoring

Docker is one of the most critically sensitive assets in terms of cybersecurity threats. Trivy has proven itself as one of the most effective tools for scanning Docker container vulnerabilities.

To monitor container images, the user must perform the following steps:

  • Test the ID (unique identifier) of the Docker container to be scanned.
  • Run the image scan directly.

For user reference: scan results can be saved in report files (text format). This is especially useful in the case of critical vulnerabilities and errors that may have serious consequences for the OS. To save the results in text format, use the following syntax:

sudo trivy image --severity HIGH > result.txt

Scanning open containers: key features

Trivy can also be used to perform internal scans of a loaded container. To do this, complete the following steps:

  1. Load the Docker file you want to test. This can be done using the command sudo docker run -it alpine.
  2. Start scanning by integrating the file into the utility.

Interesting fact: You can scan a container image as a standalone part of the overall monitoring process by integrating Trivy directly into the Dockerfile. This method is also effectively used for updating the Dockerfile when Aqua Micro is in use. To achieve this, include the scanner in the Dockerfile and initialize the image.

Where to securely run and host Docker containers

Scanning is only one stage of securing your infrastructure. Reliable and high-performance container hosting is critical for project stability. One of the best solutions is PSB.Hosting.

Advantages of PSB.Hosting:

  • Reliable VPS with AMD Ryzen processors and fast NVMe storage
  • Support for all major Linux distributions and Docker environments
  • Instant deployment and 24/7 technical support

If you plan to use Trivy for continuous monitoring, PSB.Hosting is the ideal platform for deploying Docker containers in conjunction with Kubernetes and CI/CD pipelines.

Key takeaway

The Trivy-based vulnerability scanner is one of the most effective tools for identifying critical errors in Docker containers, including hidden OS-level packages.

Regular use of this utility enables timely analysis and evaluation of open source infrastructure, as well as configuration file testing and adjustment.

Related articles

What Is a Server in Simple Terms: Types of Servers and What They Are For

What Is a Server in Simple Terms: Types of Servers and What They Are For

The word “server” sounds technical, but the idea behind it is simple. A server is a computer that runs around the clock and answers requests from other devices: it serves website pages, stores files,

Setting Up Residential Proxies on a VPS: A Step-by-Step Guide with a Worked Traffic Estimate

Setting Up Residential Proxies on a VPS: A Step-by-Step Guide with a Worked Traffic Estimate

Residential proxies are usually billed per gigabyte, so the two questions people ask before starting a data project are “how do I wire the proxy into my scraper?” and “how much traffic will it actuall

Running a Scraper on a VPS with Residential Proxies: Setup, Sticky Sessions and a Traffic Estimate

Running a Scraper on a VPS with Residential Proxies: Setup, Sticky Sessions and a Traffic Estimate

A scraper that runs on a laptop stops when the lid closes, the Wi-Fi drops or the system restarts for updates. Moving it to a VPS makes it far more available — the server keeps running when your own m

FlashID Review 2026: Anti-Detect Browser for Managing Multiple Accounts at Scale

FlashID Review 2026: Anti-Detect Browser for Managing Multiple Accounts at Scale

Partner content: FlashID. In today’s hyperconnected world, cross-border e-commerce and social media marketing have become essential growth drivers for modern businesses. However, global teams

Testing Ads and Apps for Southeast Asia: a VPS Plus a Singapore Mobile IP

Testing Ads and Apps for Southeast Asia: a VPS Plus a Singapore Mobile IP

If you run ads or launch an app for Southeast Asia, what you see from your office is not what your users see. Ad networks, app stores and many websites show different creatives, prices, languages and

How to Add the DiveChat Live Chat to a Website on a VPS

How to Add the DiveChat Live Chat to a Website on a VPS

Partner guide: PSB Hosting × DiveChat. A live chat on your website gives visitors a quick way to ask a question at the moment they are ready to buy, instead of filling in a form and waiting. If

403 Forbidden Error: Causes and How to Fix It

403 Forbidden Error: Causes and How to Fix It

A 403 Forbidden error means the server understood the request but refuses to fulfil it: access to the page or file is not allowed. Unlike 5xx errors, the server is working here — it has simply d

9HTTP: Global Proxy IP Solutions for Cross-Border Business and AI Applications

9HTTP: Global Proxy IP Solutions for Cross-Border Business and AI Applications

Partner content: 9HTTP. As businesses expand into global markets, data collection, market research, SEO monitoring, ad verification, and AI-related applications require increasingly diverse network e

504 Gateway Timeout and Error 524: Causes and How to Fix Them

504 Gateway Timeout and Error 524: Causes and How to Fix Them

Errors 504 and 524 mean essentially the same thing: the server took too long to respond and the intermediary stopped waiting. The difference is who gave up waiting — your web server or Cloudflar

Telegram