Skip to content

Instantly share code, notes, and snippets.

@eloylp
Last active September 24, 2018 06:48
Show Gist options
  • Save eloylp/7b2ec1c31acb5f604ca394a3fc759918 to your computer and use it in GitHub Desktop.
Save eloylp/7b2ec1c31acb5f604ca394a3fc759918 to your computer and use it in GitHub Desktop.
Google Cloud Cli Authentication inside docker, sharing your docker host daemon for pushing images. No need to install Gcloud Cli on your system.
## Execute this commands over your working tree.
docker pull google/cloud-sdk:latest
docker run -ti google/cloud-sdk:latest gcloud version
docker run -ti --name gcloud-config google/cloud-sdk gcloud auth login
docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk gcloud config set project <your_project_id_here>
docker run --rm -ti -v $(pwd):/src -v /var/run/docker.sock:/var/run/docker.sock:ro --volumes-from gcloud-config google/cloud-sdk bash
## Optional, set up your kubernetes credentials.
gcloud container clusters get-credentials <your_kubernetes_cluster> --zone <gcloud_cluster_zone> --project <your_project_id_here>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment