Skip to content

trivy

Installing Trivy and scanning repositories, images and Kubernetes clusters for vulnerabilities.

1 min read

Trivy is an open-source security and misconfiguration scanner. It works at every level: it can check the code in a Git repository, examine container images, advise regarding configuration files, look into Kubernetes deployments, and verify Infrastructure as Code (IaC).

installation

Terminal window
brew install trivy

The first time Trivy runs, it downloads the vulnerability database and creates a cache folder for results. You can clean it up with

Terminal window
trivy --reset

scan

Dependency scan. Trivy detects the Gemfile in our project and searches for vulnerabilities.

Terminal window
trivy fs .

Simultaneously run a scan for vulnerabilities and misconfigurations by adding --security-checks vuln,config. The scan will include any Dockerfiles, Kubernetes, and Terraform files in the repo.

Terminal window
trivy fs --security-checks vuln,config .

Scan a repository without cloning it

Terminal window
trivy repo https://github.com/...

Vulnerability testing for base/container images

Terminal window
trivy image my-test-image:version
trivy image --severity HIGH,CRITICAL my-test-image:version
trivy image --severity HIGH,CRITICAL docker_username/my-test-images:version

plugins

kubectl plugin

It scans images running in a Kubernetes pod or deployment:

Terminal window
# install the plugin
trivy plugin install github.com/aquasecurity/trivy-plugin-kubectl
# scan a pod
trivy kubectl pod mypod
# scan a deployment
trivy kubectl trivy deployment mydeployment

Related articles

1 min readTürkçe

ollama

CPU'lu makinelerde Ollama ile yerel LLM çalıştırma ve performansı artıran kritik ayarlar.

  • AI & Data
  • DevOps & Containers
4 min readTürkçe

podman

Rootless Podman ve Quadlet ile container'ları systemd kullanıcı servisi olarak çalıştırma.

  • DevOps & Containers
3 min read

Kubernetes

Running Kubernetes workloads locally with Podman, Podman Desktop, kubectl and minikube.

  • DevOps & Containers

Type to search the whole site.