Trivy Scan Image from Within a Container

So I am having an issue:

  1. I have a running container of jenkins which does some CI steps
  2. I downloaded on that jenkins container trivy inside it.
  3. In the CI pipeline if I wish to scan a docker image with trivy it says:

FATAL scan error: image scan failed: failed analysis: analyze error: timeout: context deadline exceeded

OR

trivy image trivy:test
2023-01-27T13:45:57.711Z        INFO    Need to update DB
2023-01-27T13:45:57.711Z        INFO    Downloading DB...
31.14 MiB / 31.14 MiB [----------] 100.00% 1.70 MiB p/s 18s

and than stuck after that

I diagnosed the problem like that - the docker images are stored on my pc and the steps I'm running in my CI pipeline is commands that are being executed from withing my jenkins container and trivy does not recognises the image from outside the jenkins container.

so again - How the command trivy image test:test which runs from inside the jenkins container can have access to my local docker images?

Help will be appreciated:)

1 Answer

Try to use --timeout argument and see if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest