5

EDIT: I'm just going to blame this on platform inconsistencies. I have given up on pushing to the Google Cloud Container Registry for now, and have created an Ubuntu VM where I'm doing it instead. I have voted to close this question as well, for the reasons stated previously, and also as this should probably have been asked on Server Fault in the first place. Thanks for everyone's help!

running $ gcloud docker push gcr.io/kubernetes-test-1367/myapp results in:

The push refers to a repository [gcr.io/kubernetes-test-1367/myapp]
595e622f9b8f: Preparing
219bf89d98c1: Preparing
53cad0e0f952: Preparing
765e7b2efe23: Preparing
5f2f91b41de9: Preparing
ec0200a19d76: Preparing
338cb8e0e9ed: Preparing
d1c800db26c7: Preparing
42755cf4ee95: Preparing
ec0200a19d76: Waiting
338cb8e0e9ed: Waiting
d1c800db26c7: Waiting
42755cf4ee95: Waiting
denied: Unable to create the repository, please check that you have access to do so.

$ gcloud init results in:

Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
[core]
account = <my_email>@gmail.com
disable_usage_reporting = True
project = kubernetes-test-1367
Your active configuration is: [default]

Note: this is a duplicate of Kubernetes: Unable to create repository, but I tried his solution and it did not help me. I've tried appending :v1, /v1, and using us.gcr.io

Edit: Additional Info

$ gcloud --version
Google Cloud SDK 116.0.0

bq 2.0.24
bq-win 2.0.18
core 2016.06.24
core-win 2016.02.05
gcloud
gsutil 4.19
gsutil-win 4.16
kubectl
kubectl-windows-x86_64 1.2.4
windows-ssh-tools 2016.05.13

+

$ gcloud components update

All components are up to date.

+

$ docker -v
Docker version 1.12.0-rc3, build 91e29e8, experimental
Community
  • 1
  • 1
Andrew Koroluk
  • 611
  • 6
  • 19
  • I assume you've checked the permissions on the console or via `gsutil acl get gs://us.artifacts.kubernetes-test-1367.appspot.com` or similar? – ldg Jul 10 '16 at 04:52
  • @Idg that gives me this: `BucketNotFoundException: 404 gs://us.artifacts.kubernetes-test-1367.appspot.com bucket does not exist.` – Andrew Koroluk Jul 11 '16 at 17:31
  • Yeah, without creds on your request, we won't create the bucket. – mattmoor Jul 13 '16 at 15:46

9 Answers9

3

The first image push requires admin rights for the project. I had the same problem trying to push a new container to GCR for a team project, which I could resolve by updating my permissions.

You might also want to have a look at docker-credential-gcr. Hope that helps.

fpersyn
  • 1,045
  • 1
  • 12
  • 19
2

What version of gcloud and Docker are you using?

Looking at your requests, it seems as though the Docker client is not attaching credentials, which would explain the access denial.

I would recommend running gcloud components update and seeing if the issue reproduces. If it still does, feel free to reach out to us on gcr-contact at google.com so we can help you debug the issue and get your issue resolved.

mattmoor
  • 1,677
  • 14
  • 9
  • I've added my Google Cloud & Docker versions to my answer. gcloud reports that everything is up to date. – Andrew Koroluk Jul 09 '16 at 23:30
  • What happens if you try the `docker login` command [here](https://cloud.google.com/container-registry/docs/advanced-authentication#using_an_access_token)? (specifically the oauth2token one) – mattmoor Jul 10 '16 at 15:12
  • I get this: `Error response from daemon: Get https://us.gcr.io/v1/users/: dial tcp: lookup us.gcr.io on 192.168.65.1:53: read udp 192.168.65.2:35130->192.168.65.1:53: i/o timeout` – Andrew Koroluk Jul 11 '16 at 17:36
  • `ping us.gcr.io -4` shows successful pings against `74.125.142.82` – Andrew Koroluk Jul 11 '16 at 17:36
  • `192.168.65.2` is a local network IP address, so I'm guessing you have a router or gateway that is the real problem above. I've seen this with folks moving laptops between home/work networks using boot2docker / docker-machine. Usually resetting the VM fixes this, and then try `docker login` again? – mattmoor Jul 12 '16 at 14:49
  • yeah, that's the part that concerned me, which is why I tested just a regular ping, which worked. What do you mean by 'resetting the vm'? I'm on Win 10 x64, running HyperV & Docker 1.12.0-rc3 – Andrew Koroluk Jul 12 '16 at 16:36
  • I restarted the default docker vm, and `docker-machine env`, but now I'm getting an even stranger error: `Error while pulling image: Get https://index.docker.io/v1/repositories/library/node/images: dial tcp: lookup index.docker.io on [::1]:53: read udp [::1]:59539->[::1]:53: read: connection refused` – Andrew Koroluk Jul 12 '16 at 17:41
2

I am still not able to push a docker image from my local machine, but authorizing a compute instance with my account and pushing an image from there works. If you run into this issue, I recommend creating a Compute Engine instance (for yourself), authorizing an account with gcloud auth that can push containers, and pushing from there. I have my source code in a Git repository that I can just pull from to get the code.

Andrew Koroluk
  • 611
  • 6
  • 19
  • 2
    i hope i don't have to do this. seems cray. – Randy L Oct 12 '16 at 20:54
  • 1
    @the0ther you don't. Author has most likely only allowed Container Engine admin for the service account. To push to a registry, you also need to enable Cloud Storage admin. Andrew can you confirm this (despite the fact that this question is already a year old) ? – Overdrivr Apr 25 '17 at 06:38
  • 1
    yeah there's been a lotta movement on GCR since I was here last and I'm now having no problems really at all with using it @Overdrivr. I have other Google Cloud problems now. Shaking my fist at you Cloud Endpoints! – Randy L Apr 25 '17 at 16:04
  • 1
    @the0ther XD Yeah, I haven't had trouble with this since – Andrew Koroluk Apr 25 '17 at 18:18
1

Thanks for adding your Docker version info. Does downgrading Docker to a more stable release (e.g. 1.11.2) help at all? Have you run 'docker-machine upgrade'?

jsand
  • 595
  • 4
  • 8
0

It seems like you're trying to run gcloud docker push from an Google Compute Engine instance without a proper security scope of read/write access to Google Cloud Storage (it's where Google Container Registry stores the images of your containers behind the scene).

Try to create another instance, but this time with proper access scopes, i.e.:

gcloud compute --project "kubernetes-test-1367" instances create "test" --zone "us-east1-b" --machine-type "n1-standard-1" --network "default" --scopes default="https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management","https://www.googleapis.com/auth/devstorage.full_control" --image "/debian-cloud/debian-8-jessie-v20160629" --boot-disk-size "10" --boot-disk-type "pd-standard" --boot-disk-device-name "test-1"

Once you create new instance, ssh into it and then try to re-run the gcloud docker push gcr.io/kubernetes-test-1367/myapp command

DoiT International
  • 2,405
  • 1
  • 20
  • 24
0

I checked for

gcloud auth list

to see my application is the active account and not my personal Google account. After setting

gcloud config set account example@gmail.com

I was able to push

gcloud docker -- push eu.gcr.io/$PROJECT_ID/my-docker:v1

So I can continue http://kubernetes.io/docs/hellonode/

Clemens Tolboom
  • 1,872
  • 18
  • 30
0

I had a similar issue and it turned out that I had to enable billing for the project. When you have a new Google Cloud account you can enable only so many projects with billing. Once I did that it worked.

Vin
  • 31
  • 8
  • Dont know why this post was voted down but in my case I skipped the billing setting and I was unable to deploy, after finally I completed the billing setup and linked it to my project then I can deploy it successfully, voted-up – hmaxf2 Oct 16 '17 at 06:42
0

Also this could be the cause of this problem (was in my case):

Important: make sure the Compute Engine API is enabled for your project on the

Source: https://pinrojas.com/2016/09/12/your-personal-kubernetes-image-repo-in-a-few-steps-gcr-io/

JakubKnejzlik
  • 6,363
  • 3
  • 40
  • 41
0

If anyone is still having this problem while trying to push a docker image to gcr, even though they've authenticated an account that should have the permission to do so, try running gcloud auth configure-docker and pushing again.

Dascienz
  • 1,071
  • 9
  • 14