Unable to push docker image in gce (gcr.io)

108 views
Skip to first unread message

Or Berkovitch

unread,
Oct 19, 2018, 8:51:06 AM10/19/18
to gce-discussion

I created a new VM instance on my GCE compute engine (I have Owner permissions). On that instance, I installed git, docker, and gcloud - everything is done under sudo su.

I was hoping I can use that VM instance to deploy images to GCR, but whatever I do - I cannot seem to have sufficient permissions to push the images from that instance.

1) I granted "Storage Admin" along with the "Editor" permissions to the VM Instance (autogenerated) IAM service-account.

2) When I run docker login eu.gcr.io I receive Login Succeeded with no problems.

3) I copied both a p12 key and a .json key to the .ssh folder (I generated them on the IAM console) - but that had no use too.

4) To tag and push the docker image, I use this::

docker tag [SOURCE_IMAGE] [HOSTNAME]/[PROJECT-ID]/[IMAGE]

and

docker push [HOSTNAME]/[PROJECT-ID]/[IMAGE]

Notice: It seems that at this stage (2018) gcloud docker -- push is obsolete (and it didn't work for me as well...)

Notice: The bucket is NOT created yet, so setting permissions on the Storage console is out of the question at this point.

What could be the reason for the Permission Denied problem ?


Larbi (Google Cloud Support)

unread,
Oct 19, 2018, 11:12:39 AM10/19/18
to gce-discussion
The problem is that you need to use sudo in front of the command :

sudo docker push [HOSTNAME]/[PROJECT-ID]/[IMAGE]

The permission isssue that you get it not related to the Google cloud.
If you still has the issue past the full screenshot of the error, this will help understand where exactly the issue occur .

Or Berkovitch

unread,
Oct 19, 2018, 12:45:44 PM10/19/18
to gce-discussion
This is not the answer. I wrote that I am running under sudo su; Please read the question.

Larbi (Google Cloud Support)

unread,
Oct 19, 2018, 1:01:23 PM10/19/18
to gce-discussion
I just used the docker push images and I did  add sudo because from the beginning an not root.
to verify your issue past the full screenshot of the error or the output, this will help figure out what happening.   
Reply all
Reply to author
Forward
0 new messages