Configuring gcloud SDK to upload docker images


You need to add the credential helpers properly to the docker's config.json which is located at ~/.docker/config.json to upload your images to Google Cloud Container Registry

To do this on your local computer follow the two steps mentioned below

1. init (If not already done)

If you have not already done gcloud init please run the following command

$ gcloud init

This will help you authenticate the google cloud account and let you choose the project and default zone for the Compute Engine.

2. configure-docker

Run the following command after init to setup the credential helpers

gcloud auth configure-docker

This command out puts something like following

$ gcloud auth configure-docker
The following settings will be added to your Docker config file 
located at [/Users/foo/.docker/config.json]:
 {
  "credHelpers": {
    "gcr.io": "gcloud", 
    "us.gcr.io": "gcloud", 
    "eu.gcr.io": "gcloud", 
    "asia.gcr.io": "gcloud", 
    "staging-k8s.gcr.io": "gcloud", 
    "marketplace.gcr.io": "gcloud"
  }
}

Do you want to continue (Y/n)?  Y

Docker configuration file updated.

Thats it, now you all set to go for uploading images to Google Cloud Container Registry.