-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Not able to scan image in Google Artifact Registry #783
Comments
Is
|
I have given permissions using In GKE dashboard, I have confirmed that this Service Account - [email protected] - is asigned the role |
Case#2:In another custom container with Case#2 code:
Logs of above code:
So, I guess I need to run the equivalent of |
Hi @manishjagtap , When I force the content of my
(this snippet embed Jfrog artifactory auth. example, not needed in your case) |
Thanks a lot @tisc0 The way I am running the Pipeline goes something like:
After force creating
because the official Note that Case#2 works fine because I was expecting the standalone, official
|
Using Standalone Credential Helper for authenticating with Google Artifact Registry worked for me. Using some hack, copied the The config.json got created by running
So, the final working code is:
That said, is this the right way? I am pretty sure I am not the first person to face this issue. :) |
From within the
I am still not convinced that I have to copy the |
It should be possible to auth with
|
Official |
This issue is stale because it has been labeled with inactivity. |
sorry for necrobumping, but I could not find if there is any solution to get authenticated to GCR with a credentials json file... I am trying to run the |
The trivy container doesn't have gcloud, the standalone credential helper, nor docker, but we can manually set up the docker config.json file to contain the necessary authentication information. In this gitlab job sample # manually reproducing the effect of `docker login -u _json_key --password-stdin < $GOOGLE_APPLICATION_CREDENTIALS`
- GCR_AUTH=$(echo "_json_key:$GCP_KEY" | base64 | tr -d '[:space:]')
- |
mkdir ~/.docker && cat << EOF > ~/.docker/config.json
{"auths":
{
"us-central1-docker.pkg.dev":{"auth":"$GCR_AUTH"}
}
}
EOF |
@manishjagtap, are you able to scan the image in Google Artifact Registry? We could add the relevant information to the trivy documentation. |
@mykter I am trying to achieve the same with gitlab CI job. It works if I pull the docker image on my Docker for Mac but when I do the same in gitlab-ci.yaml file, it gives me the error of permission denied. My CI stage is as follows:
|
@ahsan-raza what line triggers the error message? It wouldn't surprise me if the trivy container has changed in some way since I used this workaround. |
It breaks on trivy image command. I tried to run the previous docker image but all in vain.
|
Description
trivy version:
0.15.0
I have two GCP projects within our organization:
trivyProject
: Whereaquasec/trivy:0.15.0
container is runtargetProject
: Has Google Artifact Registry that hosts container images to scan.From
aquasec/trivy:0.15.0
container running intrivyProject
project, I want to scan images in another projecttargetProject
.I have created a Service Account in trivyProject and have assigned it
artifactregistry.reader
as follows. I have already checked that:artifactregistry.reader
on the target registryGOOGLE_APPLICATION_CREDENTIALS
file.Case#1:
In the official
aquasec/trivy:0.15.0
container running intrivyProject
:What did you expect to happen?
Expected trivy to scan the image.
What happened instead?
Got permission denied error
Output of run with
-debug
:Case#1 Logs:
Output of
trivy -v
:Additional details (base image name, container registry info...):
Image to be scanned - equivalent to
us-docker.pkg.dev/targetProject/myRegistry/myImage:1.0.0
- is in Google Artifact Resgistry.Any pointers on why I may be getting permission denied error?
The text was updated successfully, but these errors were encountered: