I have a docker image, it works locally.
I have authenticated in gcloud CLI by executing
gcloud auth application-default login
And after confirming in my browser, using the credentials helper:
gcloud auth configure-docker australia-southeast1-docker.pkg.dev
My Docker config file looks like:
{
"credHelpers": {
"asia.gcr.io": "gcloud",
"australia-southeast1-docker.pkg.dev": "gcloud",
"eu.gcr.io": "gcloud",
"gcr.io": "gcloud",
"marketplace.gcr.io": "gcloud",
"staging-k8s.gcr.io": "gcloud",
"us.gcr.io": "gcloud"
}
}
I have double checked it’s the config docker is using by running docker
and verifying it’s the location of the default.
I have a repository named “scaper” (without an ‘r’) in a project named “colesworths”.
It’s in this same australia-southeast1 region. I’ve double checked that both myself and the Google Account Services user have the right roles.
On the repository, I can see my normal user listed with the right access:
I have tagged the image as per google tutorial:
> sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
australia-southeast1-docker.pkg.dev/colesworths/scaper/scraper latest 2aca96d9e3e2 58 minutes ago 1.65GB
scraper latest 2aca96d9e3e2 58 minutes ago 1.65GB
ubuntu 22.04 53a843653cbc 2 weeks ago 77.9MB
But when trying to push, I get an unauthenticated error:
>sudo docker push australia-southeast1-docker.pkg.dev/colesworths/scaper/scraper:latest
The push refers to repository [australia-southeast1-docker.pkg.dev/colesworths/scaper/scraper]
36ff81bab7ad: Preparing
8df17942bcab: Preparing
16f00d753434: Preparing
65bb99eee75b: Preparing
59fbcd1fa941: Preparing
353f35f5d7b1: Waiting
ee97c5c0662c: Waiting
587485d140fe: Waiting
1b9b7346fee7: Waiting
denied: Unauthenticated request. Unauthenticated requests do not have permission "artifactregistry.repositories.uploadArtifacts" on resource "projects/colesworths/locations/australia-southeast1/repositories/scaper" (or it may not exist)
I’m certain the resource exists (as per screenshots), and I’m fairly certain I’m logged in as per the gcloud auth
pieces.
What am I missing?
Turns out the issue was because I didn’t create a security group for docker. You should probably do that.
If you use sudo docker
, you need to authenticate with gcloud using sudo
as well.