Search code examples
dockergclouddocker-machinegoogle-container-registry

gcloud docker push reliability


I have been having a lot of problems pushing images with gcloud docker push over the past few weeks. I've read through the many stack overflow discussions and github issues and workarounds but I haven't come across a solution to the inconsistency yet.

Typically I will attempt to push a container image or two. The first push will almost always fail with the following retry-until-timeout output:

enter image description here

I can only get around it with gcloud auth login. At most 5 minutes later I will attempt to push a second image, and will again see the retry-until-timeout issue. I will see this on every attempt until I gcloud auth login again.

Often I will have to manually retry several more times immediately after authenticating before the image is actually pushed.

  1. Am I actually being logged out (I can still access pods and instances, etc with kubectl and gcloud machines)? If so, why is being logged out inconsistent and what does building docker containers do that it would invalidate my local gcloud session?
  2. If not, why can't I gcloud docker push until I authenticate again? After that, why is this still inconsistent (I suspect it may have little or nothing to do with the real issue).
  3. Is there a way to make pushing images on OSX with docker-machine and gcloud docker push reliable? Is there another way to get images to the cloud repository (preferably from the command line)?

gcloud --version alpha 2016.01.12 beta 2016.01.12 bq 2.0.18 bq-nix 2.0.18 core 2016.02.11 core-nix 2016.02.05 gcloud gsutil 4.16 gsutil-nix 4.15 kubectl kubectl-darwin-x86_64 1.1.7

docker --version Docker version 1.10.1, build 9e83765

docker-machine --version docker-machine version 0.6.0, build e27fb87

virtualbox version 5.0.14 r105127


Solution

  • I never faced the problems you mentioned with gcloud docker, but regarding your last point,

    Is there another way to get images to the cloud repository (preferably from the command line)?

    it is indeed possible to push to the gcr.io repos without going through gcloud, e.g:

    docker login -e [email protected] -p $(gcloud auth print-access-token) -u _token https://gcr.io
    docker push [your-image]
    

    Credits to mattmoor, more info in original answer here: Access google container registry without the gcloud client