-
Notifications
You must be signed in to change notification settings - Fork 2.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failed to download vulnerability DB using the docker image #2816
Comments
I guess your server is under a proxy or something similar. Please make sure your server is able to reach ghcr.io. |
it is not under a proxy, and it works with |
and thank you @knqyf263 for your help. |
No, I meant without if it shows below, it would be fine.
|
and it still does not work without |
This issue is stale because it has been labeled with inactivity. |
I'm having the same errors with trivy
|
@danielnbalasoiu thanks for your report! we're trying to clarify this error right now could give us a bit more information? what is your OS/arch? ex: MasOS/arm64, Linux etc/ Do you try to run Trivy with thanks a lot |
I'm running it on a Linux (Ubuntu) What have I tried?
docker run --env-file .docker-env --net=host --rm aquasec/trivy --debug --insecure server --listen localhost:8080
Debug infodebug1$ docker run --env-file .docker-env --net=host -it --rm --entrypoint sh aquasec/trivy
Unable to find image 'aquasec/trivy:latest' locally
latest: Pulling from aquasec/trivy
213ec9aee27d: Pull complete
ad53b2e0219a: Pull complete
2399349afd31: Pull complete
dc0298aa2f10: Pull complete
Digest: sha256:a5544f44ca957135921410f4d3fa340d42b6ab56bbb6bf7406d783df9e84f95f
Status: Downloaded newer image for aquasec/trivy:latest
/ # sed -i 's/https/http/g' /etc/apk/repositories
/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
v3.16.3-13-g4d933a1fa3 [http://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.3-12-g2affb64843 [http://dl-cdn.alpinelinux.org/alpine/v3.16/community]
OK: 17041 distinct packages available
/ # trivy server --listen localhost:8080
2022-11-23T16:32:59.674Z INFO Need to update DB
2022-11-23T16:32:59.674Z INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-23T16:32:59.674Z INFO Downloading DB...
2022-11-23T16:32:59.720Z FATAL failed to download vulnerability DB: OCI artifact error: OCI artifact error: OCI repository error: Get "https://ghcr.io/v2/": dial tcp 140.82.121.33:443: connect: connection refused debug2$ docker run --env-file .docker-env --net=host --rm aquasec/trivy --debug --insecure server --listen localhost:8080
2022-11-23T16:39:41.181Z DEBUG cache dir: /home/runner/.cache/trivy
2022-11-23T16:39:41.182Z DEBUG There is no valid metadata file: unable to open a file: open /home/runner/.cache/trivy/db/metadata.json: no such file or directory
2022-11-23T16:39:41.182Z INFO Need to update DB
2022-11-23T16:39:41.182Z INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-23T16:39:41.182Z INFO Downloading DB...
2022-11-23T16:39:41.182Z DEBUG no metadata file
2022-11-23T16:39:41.207Z FATAL failed to download vulnerability DB:
github.com/aquasecurity/trivy/pkg/commands/operation.DownloadDB
/home/runner/work/trivy/trivy/pkg/commands/operation/operation.go:117
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).Download
/home/runner/work/trivy/trivy/pkg/db/db.go:154
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).initOCIArtifact
/home/runner/work/trivy/trivy/pkg/db/db.go:194
- OCI repository error:
github.com/aquasecurity/trivy/pkg/oci.NewArtifact
/home/runner/work/trivy/trivy/pkg/oci/artifact.go:69
- Get "https://ghcr.io/v2/": dial tcp 140.82.121.34:443: connect: connection refused |
@danielnbalasoiu thanks for your details. will investigate more |
@danielnbalasoiu if you use proxy, I can reproduce Could you check it? |
note: |
@afdesk , I tested this scenario: $ docker run --add-host ghcr.io:140.82.121.34 --env-file .docker-env --net=host --rm --entrypoint=cat aquasec/trivy /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
140.82.121.34 ghcr.io $ docker run --add-host ghcr.io:140.82.121.34 --env-file .docker-env --net=host --rm aquasec/trivy --debug server --listen localhost:8080
2022-11-26T13:48:09.493Z DEBUG cache dir: /home/runner/.cache/trivy
2022-11-26T13:48:09.493Z DEBUG There is no valid metadata file: unable to open a file: open /home/runner/.cache/trivy/db/metadata.json: no such file or directory
2022-11-26T13:48:09.493Z INFO Need to update DB
2022-11-26T13:48:09.493Z INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-26T13:48:09.493Z INFO Downloading DB...
2022-11-26T13:48:09.493Z DEBUG no metadata file
2022-11-26T13:48:09.498Z FATAL failed to download vulnerability DB:
github.com/aquasecurity/trivy/pkg/commands/operation.DownloadDB
/home/runner/work/trivy/trivy/pkg/commands/operation/operation.go:117
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).Download
/home/runner/work/trivy/trivy/pkg/db/db.go:154
- OCI artifact error:
github.com/aquasecurity/trivy/pkg/db.(*Client).initOCIArtifact
/home/runner/work/trivy/trivy/pkg/db/db.go:194
- OCI repository error:
github.com/aquasecurity/trivy/pkg/oci.NewArtifact
/home/runner/work/trivy/trivy/pkg/oci/artifact.go:69
- Get "https://ghcr.io/v2/": dial tcp 140.82.121.34:443: connect: connection refused Personally, I think it's related with the MITM stuff that proxy server is doing (see the |
@danielnbalasoiu thanks for your help. i'll wait for your updates. just a note. it doesn't matter in your case, but Trivy needs access to 2 hosts for DB downloading: |
@afdesk, I managed to get it working even without having to include / # trivy --debug server --listen localhost:8080
2022-11-29T16:49:33.345Z DEBUG cache dir: /root/.cache/trivy
2022-11-29T16:49:33.345Z DEBUG There is no valid metadata file: unable to open a file: open /root/.cache/trivy/db/metadata.json: no such file or directory
2022-11-29T16:49:33.345Z INFO Need to update DB
2022-11-29T16:49:33.345Z INFO DB Repository: ghcr.io/aquasecurity/trivy-db
2022-11-29T16:49:33.345Z INFO Downloading DB...
2022-11-29T16:49:33.345Z DEBUG no metadata file
2022-11-29T16:49:36.180Z DEBUG Updating database metadata...
2022-11-29T16:49:36.180Z DEBUG DB Schema: 2, UpdatedAt: 2022-11-29 12:08:16.282509734 +0000 UTC, NextUpdate: 2022-11-29 18:08:16.282509334 +0000 UTC, DownloadedAt: 2022-11-29 16:49:36.180694584 +0000 UTC
2022-11-29T16:49:36.181Z INFO Listening localhost:8080... Thank you for your prompt replies and your awesome work! 🚀 |
This issue is stale because it has been labeled with inactivity. |
This issue is stale because it has been labeled with inactivity. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Description
From one server, the DB can not be downloaded using docker:
The exact same command works on my personal computer.
They both use the same ubuntu and docker versions.
On the server, I can work-around it using
--insecure
:This is very similar to issue #2689 (reply in thread)
I tried
docker logout ghcr.io
with no success.I upgraded this server to ubuntu 20.04 and the latest docker version 20.10.17 today, so this is probably related.
The text was updated successfully, but these errors were encountered: