How to run a Trivy scan on Windows?

Viewed 4221

In the installation page for Trivy there is no mention of Windows.

I have Docker for Windows installed so the Docker method looks promising but there are a couple of things I'm not sure of:

  1. What should I set the cache directory to?
  2. Will I need to "mount docker.sock"? And if so, will I need to replace the /var/run and $HOME/Library/Caches directories in that command with something more "Windows-ey"?

The aim is to scan an image that I built using Docker for Windows.

4 Answers
  1. Install Docker for Windows
  2. Install Git Bash
  3. Open a Git Bash Shell on Windows
  4. Execute the command: docker pull aquasec/trivy:0.19.2
  5. docker run --rm -v C:\Users\<your foldername>:/root/.cache/ aquasec/trivy:0.19.2 aquasec/trivy:0.19.2 python:3.4-alpine
  6. The scan will start to run. It may take a few minutes to return any response.

With Docker Deskttop for windows installed you can open a terminal (recomended powershell for the next command).

docker run --rm -v ${PWD}/tmp:/root/.cache/ -v //var/run/docker.sock:/var/run/docker.sock  aquasec/trivy <image>

You can use your actual path with this command. It´s better than use absolute paths. Also, you can mount the docker socket to trivy to scan your downloaded images.

First, I used the WSL to scan the windows containers. Last, I used the go compiler to build a trivy.exe.

Both of these 2 ways work well.

Related