Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing docker image through jenkins

I'm pushing docker image through Jenkins pipeline, but I'm getting the following error:

ERROR: Could not find credentials matching gcr:["google-container-registry"]

I tried with:

gcr:["google-container-registry"]
gcr:[google-container-registry]
gcr:google-container-registry
google-container-registry

but none of them worked.

In the global credentials I have:

NAME: google-container-registry

KIND: Google Service Account from private key

DESCRIPTION: A Google robot account for accessing Google APIs and services.

like image 977
Agustin Castro Avatar asked Sep 16 '25 23:09

Agustin Castro


1 Answers

The proper syntax is the following (provided your gcr credentials id is 'google-container-registry'):

docker.withRegistry("https://gcr.io", "gcr:google-container-registry") {
  sh "docker push [your_image]"
}
like image 110
gmc Avatar answered Sep 19 '25 15:09

gmc