gitlab-runner failing to pull image from google artifact registry

224 views Asked by At

I have created VM(container optimised OS) on gcp and installed gitlab runner with gitlab runner image with command: docker run -d --name gitlab-runner --restart always --log-driver none -v /home/<user_name>/srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock -v /home/<user_name>/.docker/config.json:/root/.docker/config.json:ro gitlab/gitlab-runner:latest

after that i exec into the container and registered the runner for my repo(docker executor). the runner connected and picks the job perfectly with ruby:2.7 image as default image.

But now i have to use the image from my artifact registry in google as default image, so i changed the config.toml to make it as default image. Now the issue starts, the runner cant able to pull the image and job fails: error: ERROR: Job failed: failed to pull image "europe-west1-docker.pkg.dev//staging//:" with specified policies [always]: Error response from daemon: Head "https://europe-west1-docker.pkg.dev/v2//staging///manifests/": denied: Permission "artifactregistry.repositories.downloadArtifacts" denied on resource "projects//locations/europe-west1/repositories/staging" (or it may not exist) (manager.go:237:0s)

I tried , FYI, I have given access from my VMs service account to the artifact registry and I am able to pull the image from my vm using docker pull, but in gitlab-ci the runner cant able to pull the image and throws above error.

i have run docker-credential-gcr configure-docker --registries europe-west1-docker.pkg.dev , on my vm and after that i can pull image from artifact registry. But why it is failing for my runner running on same VM. can anyone please help me out here. Im stuck Welcome for any suggestions

0

There are 0 answers