This script downloads the Trivy database without using Docker or Oras as described in the Trivy documentation in restricted environments. See: Trivy Air-Gap Documentation.
This script queries the GitHub Container Registry API to get access tokens, lists the available tags for the desired Trivy databases (trivy-db and trivy-java-db), allows the user to select a specific tag, and downloads the corresponding database using system or custom proxy settings.
curl- for making HTTP requestsjq- for parsing JSON responses
Install on Ubuntu/Debian:
sudo apt-get update
sudo apt-get install curl jqInstall on RHEL/CentOS/Fedora:
sudo yum install curl jq- PowerShell 5.1 or higher (included with Windows 10/11)
- Internet connectivity
- Linux
git clone https://github.com/GhioRodolphe/trivy-db-downloader.git cd trivy-db-downloader chmod +x get-trivy-db.sh ./get-trivy-db.sh - Windows
git clone https://github.com/GhioRodolphe/trivy-db-downloader.git cd trivy-db-downloader .\Get-TrivyDB.ps1
The script will prompt you to select a tag for each database and download the corresponding files.
manifestFile-trivy-db.jsontrivy-db.tar.gzmanifestFile-trivy-java-db.jsonmanifestFile-trivy-java-db.tar.gz
Version: 0.1
Author: GHIO Rodolphe
If you have any questions, feel free to contact me.