Unable to run gcloud docker push from google compute engine instance

3/20/2017

When I do gcloud docker push i get the following error.

denied: Unable to create the repository, please check that you have access to do so.

gcloud info shows correct project name as configured in gcloud.

Can somebody please guide me with this issue? Or suggest an alternative.

I have tried directly logging in without gcloud, login succeeds but push fails

$docker login -e 2983212121577-compute@developer.gserviceaccount.com -u oauth2accesstoken  -p "$(gcloud auth print-access-token)" https://gcr.io
Flag --email has been deprecated, will be removed in 1.14.
Login Succeeded
$ docker push gcr.io/project/imagename
...
denied: Unable to create the repository, please check that you have access to do so.

$ gcloud --version Google Cloud SDK 147.0.0

$ docker --version Docker version 17.03.0-ce, build 3a232c8

-- abb
docker
gcloud
google-container-registry
google-kubernetes-engine

1 Answer

3/20/2017

If you do

gcloud docker -- push gcr.io/X/Y

you will need to have permission to write to the GCP named 'X'. Typically you will need to be added to that project as a project EDITOR.

In this case GCR does not complain about the project shown by 'gcloud info'.

-- Nghia Tran
Source: StackOverflow